Created
September 13, 2016 01:40
-
-
Save youzipi/c0e147957c747638a8604d863317c230 to your computer and use it in GitHub Desktop.
jquery.validate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#newCustomerForm").validate({ | |
submitHandler: function (form) { | |
form.submit(); | |
}, | |
errorPlacement: function (error, element) { | |
error.appendTo(element.parents('.form-group')); | |
}, | |
rules:{ | |
customerUsername: { | |
isMobile:true, | |
remote: { | |
url: "checkbossmobileexist.htm", | |
type: "post", | |
data: { | |
mobile: function() { | |
return $( "#customerUsername" ).val(); | |
} | |
}, | |
dataFilter: function(data, type) { | |
console.log(data); | |
console.log(type); | |
return data == 0; | |
}, | |
// success: function (data) { | |
// return data > 0; | |
// } | |
} | |
} | |
}, | |
messages: { | |
customerUsername:{ | |
remote:"该手机号已注册" | |
}, | |
// newAgentProvince: { | |
// required: "省份不能为空" | |
// }, | |
// newAgentCity: { | |
// required: "城市不能为空" | |
// }, | |
// newAgentCounty: { | |
// required: "区县不能为空" | |
// }, | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment