标签:sage new one remove header highlight json data inter
$("#getCode").on("click", getCodeClick);
function getCodeClick() {
if(!validatePhone(‘phone‘,$(‘#txtMobile‘)) || $(‘#txtMobile‘).attr(‘phone‘) != ‘true‘){
return false;
}
$("#ErrMessage").html("");
$("#getCode").off("click");
try {
new common.ajaxRequest({
url: url+"cmbntUser/getChangePhoneAuthCode?mobilePhone="+ $("#txtMobile").val().trim(),
type: "POST",
param: ‘‘,
dataType: "json",
header: header,
callBack: function (result) {
if(result.type =="SUCCESS"){
var lefttime = 60;
$("#getCode").attr("disabled", "disabled");
$("#getCode").html("60秒后重新获取");
var countDown = setInterval(function () {
lefttime--;
$("#getCode").html(lefttime + "秒后重新获取");
if (0 == lefttime) {
$("#getCode").html("重新获取");
$("#getCode").removeAttr("disabled");
$("#getCode").on("click", getCodeClick);
clearInterval(countDown);
}
}, 1000);
}else{
$("#ErrMessage").html(result.message);
$("#ErrMessage").attr("class", "tip textred");
$("#getCode").on("click", getCodeClick);
}
}
});
}
catch (ex) {
$("#ErrMessage").html("发送短信失败,请稍后再试。");
$("#ErrMessage").attr("class", "tip textred");
}
return false;
}
标签:sage new one remove header highlight json data inter
原文地址:https://www.cnblogs.com/myyouzi/p/11162000.html