发送验证码

Posted myyouzi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了发送验证码相关的知识,希望对你有一定的参考价值。

$("#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;

 

以上是关于发送验证码的主要内容,如果未能解决你的问题,请参考以下文章