日期:2014-05-17 浏览次数:20623 次
function showRequest(formData, jqForm, options) { var queryString = $.param(formData); var thisForm = jqForm[0]; var loginName = thisForm.username.value; if (loginName == '') { alert("Username is required!"); return false; } return true; } function submitForm(thisForm) { var options = { target: '#loginForm', beforeSubmit: showRequest, success: showResponse, error: showError, url: 'login.ns.module/loginAction.action', type: 'post', dataType: 'html', clearForm: true, resetForm: true, timeout: 3000 }; $(thisForm).submit(function() { $(thisForm).ajaxSubmit(options); return false; }); } //--> </script> </head> <body> <form name="loginForm" method="get" onsubmit="return submitForm(this);"> <p><label accesskey=u>用户:<input type="text" name=username width="115px" maxlength="18"></label></p> <p><label accesskey=p>密码:<input type="password" name=password width="115px" maxlength="18"></label></p> <p><input type="submit" name="submitButton" value="登陆"/></p> </form> </body> </html>
$(thisForm).submit(function() { $(thisForm).ajaxSubmit(options); return false; });
------解决方案--------------------