你是否正在寻找关于submithandler的内容?让我把最直接的东西奉献给你:
补充一下,这个submithandler:function(){}方法内可以写任何方法,。但最后要有一个form.submit或form.ajaxSubmit
比如我这个
$(document).ready(function(){
$("#loginForm").validate({
rules: {
shouJiHaoMa: {
required: true,
digits: true
},
pwd: {
required: true
}
},
messages: {
shouJiHaoMa: {
required: '请输入手机号码',
digits: '请输入正确的手机号码'
},
pwd: {
required: '请输入密码'
}
},
// specifying a submitHandler prevents the default submit, good for the demo
submithandler: function() {
login();
return false;
},
errorElement: "em",
success: function(label) {
label.text(" ")//清空错误提示消息
.addClass("success");//加上自定义的success类
}
});
我的login()内最后提交了form
login = function() {
$('#login_tmp').remove();
var options = {
type : "get",
dataType : "json",
url : "login.do",
data : {"method" : "ajaxLogin"},
cache : "false",
beforeSubmit : beforeCallBack,
success : loginCallBack,
error : errorCallBack
};
// 异步提交登陆请求
$("#loginForm").ajaxSubmit(options);
}
以上就是关于submithandler的全部内容,相信你一定会非常满意。
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-15695-1.html
你确定
是央行拿捏恰当