我在验证方法中调用了一个web服务,但是在没有完成webservice的情况下返回了Validation方法,
代码和GT;>
jQuery.validator.addMethod("name", function (value, element) {
var validUsername = false;
$.ajaxSetup({ "async": false });
$.getJSON(serverName + '/handlers/qs-user.ashx?callback=?', {
'username': $("#email").val(),
'op': 'GetMobileUser'
},
function (data) {
if (data.UserId == "null") {
validUsername = true;
} else {
validUsername = false;
}
});
$.ajaxSetup({ "async": true });
var result = this.optional(element) || value == "" || validUsername;
if (!result) {
var validator = this;
setTimeout(function () {
validator.blockFocusCleanup = true;
element.focus();
validator.blockFocusCleanup = false;
}, 1);
}
return result;
}, "That e-mail address has already been used.");
如何同步此Web服务调用.. 如
$.ajaxSetup({ "async": false });
无效 感谢您查看此事。 :)