Apply again in 60 seconds, mobile phone verification code

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

//The following is to get the verification code! ! ! ! and get it again after 60 seconds
$("#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);
}

Guess you like

Origin blog.csdn.net/qq_37120477/article/details/90746664
Recommended