$.validator.addMethod("noanon", function(value) {
return ajaxFunction();
}, 'Username already exists.');
addMethod函数有3个参数。名称,实际运行的逻辑,最后是用于失败的默认消息。
name: {
required: true,
minlength: 2,
noanon: true
},
现在如果我使用ajaxFunction,那么就会出现一些错误。
答案 0 :(得分:1)
您可以使用remote
方法:
rules: {
name: {
remote : "script.php"
}
},
messages: {
name: {
remote : "Page with this name is exists"
}
}
在PHP中,您可以使用$_GET['name']
。
其他信息here