remote的bug应该怎样改?
他只能这样用。。
email: { remote: '/CheckEmail.aspx' } },
但不能
email: { remote:{url:'/CheckEmail.aspx',data:{email:$("#emial").val} },type:"POST" } },
这样用。
因为他到后台是取不到email的值。
他只能这样用。。
email: { remote: '/CheckEmail.aspx' } },
但不能
email: { remote:{url:'/CheckEmail.aspx',data:{email:$("#emial").val} },type:"POST" } },
这样用。
因为他到后台是取不到email的值。
remote: function(value, element, param) {
if (this.optional(element))
return "dependency-mismatch"; var previous = this.previousValue(element); if (!this.settings.messages[element.name])
this.settings.messages[element.name] = {};
this.settings.messages[element.name].remote = typeof previous.message == "function" ? previous.message(value) : previous.message;
param = typeof param == "string" && { url: param} || param;
if (previous.old !== value) {
previous.old = value;
var validator = this;
this.startRequest(element);
var data = {};
for (X in param.data) {
data[X] = param.data[X];
}
data[element.name] = value; $.ajax($.extend(true, {
url: param,
mode: "abort",
port: "validate" + element.name,
dataType: "json",
data: data,
success: function(response) {
if (response) {
var submitted = validator.formSubmitted;
validator.prepareElement(element);
validator.formSubmitted = submitted;
validator.successList.push(element);
validator.showErrors();
} else {
var errors = {};
errors[element.name] = response || validator.defaultMessage(element, "remote");
validator.showErrors(errors);
}
previous.valid = response;
validator.stopRequest(element, response);
}
}, param));
return "pending";
} else if (this.pending[element.name]) {
return "pending";
}
return previous.valid;
},
是他这个方法有问题。。
http://community.csdn.net/IndexPage/SmartQuestion.aspx
简单来说就是 jquery.validate的remote 方法怎样用