<form id="result" name="result" action="/HelloStruts2/views/register.action" method="post"> <label>UserName</label> <input type="text" name="userBean.username" value="" id="result_userBean_username"/> <input type="submit" id="registerSubmit" value="Submit"/> </form>
$(document).ready(function(){ $('#result').on('submit',function(e){ e.preventDefault();
//阻止默认的事件 $.ajax({ //this is the php file that processes the data and send mail url: "register.action", //GET method is used type: "POST", //Do not cache the page cache: false, //success success: function (html) { $('#content').html(html); } }); }) })