做登录界面的时候发现有时候点击登录按钮页面无响应,要重新加载一遍网页证书才能登录,请问这有什么好的解决办法吗?网上有人说网络太差也会出现这样的情况
var validate2 = $("#form2").validate({
/*自定义验证规则*/
debug: true,
rules: {
username: {
required: true,
},
password: {
required: true,
},
},
messages: {
username: {
required: '请输入用户名',
},
password: {
required: '请输入密码',
}
},
errorPlacement: function (error, element) {
error.appendTo(element.parent().next());
},
submitHandler: function (form) {
var userName = $("[name|='username']").val();
var passWord = $("[name|='password']").val();
loginByUserName(userName, passWord);
}
});
...部分删减 太长了
function loginByUserName(userName, passWord) {
loginMagByUserName.param.userNameOrPhone = userName;
loginMagByUserName.param.password = passWord;
$.postJSON("LoginByPassword", loginMagByUserName, function (ajaxData) {
if (ajaxData.head.code === "C2000") {
localStorage.token = ajaxData.head.token;
location.href="main.html"
} else {
$("#error2").append("用户名或密码错误");
}
});
}