60秒再次申请,手机验证码

                                **60秒再次点击申请,验证码**

//下面是获取验证码!!!!和60秒后再次获取
$("#get").click(function () {
var Iphone=phone.value;
$.ajax({
type: “post”,
url:“appUser/getCheckCode”,
dataType: “json”,
data:{“phoneNum”:Iphone},
success: function (data) {
console.log(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(“yan”);
}
});
$(this).attr(“disabled”, “disabled”);
downTime();

})
function downTime() {
    var at = 60;
    var MyTime = setInterval(function () {
        if (at > 0) {
            at--;
            $("#get").val(at + "秒后重新获取").addClass("noBut");
        }
        else if (at == 0) {
            $("#get").val("重获验证码").removeAttr("disabled").removeClass("noBut");
            clearInterval(MyTime);
        }
    }, 1000);
}

猜你喜欢

转载自blog.csdn.net/qq_37120477/article/details/90746664