专注、交流、分享
云计算领域最新资讯

jQuery验证插件remote会导致出现验证正确的样式解决方案

原因是远程采用的是异步提交,也就是不管最后的结果是true 还是false,都具有延迟,但是程序程序早已经往下执行了。下面介绍一些解决方法:

直接进行重写插件的remote方法,让它发送数据请求可以变成发展同步的即可,主要是通过添加选项async: false

$validator.Methods. Remote = function (value, element, parameter, method){
//Console.Log (value, element, parameter, method);
if (this.optional(element)) {
Returns dependency-mismatch;
}
Method = type, method = = “string“ and method | | “remote“;
Var previous = this.Previous values (elements, methods),
Verifier, data, Select Data Collection;
If (! This. Settings).Message [ element ].name]) {
Here, set it up.Message [ element ].Name] = {};
}
Original information = previous page.Original message 𞓜 this.Set Up. Message Element.Name] [method];
Here, set it up.Message [ element ].Method = previous. .message;
stop=typeof-halt==“string“65286“652866“url:halt}$124“124stop“
Select data collection = $.param($.extend({data:value},param。data));
If (previously).old===option
Go back to the previous one.valid;
}
previous.old=optionDataString;
Verifier = this;
Sentence is too long, please supply a shorter sentence
data = {};
Data [element].Name] = value;
$.ajax($.extend(true, {
mode: “abort“,
Port: verify + element.name,
dataType: “json“,
data: data,
async: false,
CONTEXT: validator.Current form,
success: function (response) {
= = “True”| | response = = “True”,
Error, message, submitted;
Verifier, set.Message [ element ].Method = previous. .Original information;
if (valid) {
Commit = validator.Forms submitted;
Using the validator.xml. RESETINTERNALS () ;
Validator. Tohide = validator.Element error);
validator.formsubmitted=submitted;
Verifier, success list.Push (element);
Verifier. Invalid [ element.Name] = false;
1. Verifier. SHOWRORS ()
} else {
errors = {};
Message = response | validator.Defaultmessage (element){
method: method,
parameters: value
});
Error [ element ].Name] = previous.Message = message;
Verifier. Invalid [ element.Name] = true;
Display Errors;
}
Previous. Valid = valid;
Stop request (element, valid) ;
}
}, param));
Return to “pending“;
}

 

以上就是关于“jQuery验证插件remote会导致出现验证正确的样式解决方法”的相关解答,若有不清楚的可以咨询九零云,九零云作为云南为数不错持有ICP/ISP/IDC等资质专业云计算提供商之一,成本控制良好,提供各类云服务器产品及ICP备案一站式服务,操作简单快捷,7*24小时不间断售后运维技术支持。

产品选购地址:

https://www.90y.cn/cloudhost/

赞(0) 打赏
未经允许不得转载:九零云资讯 » jQuery验证插件remote会导致出现验证正确的样式解决方案
分享到: 更多 (0)

中国领先的企业级云服务提供商

域名注册云服务器

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏