function countdown()
        {
            var time=60;
            setTime=setInterval(function(){
                if(time<=0){
                    clearInterval(setTime);
                    $('.sendcode').attr("disabled", false);
                    $('.sendcode').text("发送验证码");
                    return;
                }
                time--;
                $('.sendcode').text(time+'s后重试');
            },1000);
        }
        $('.sendcode').click(function () {
            $('.error_msg').html("");
            var mobile = $('#mobile').val();
            $.ajax({
                type: 'POST',
                url: 'send_code_for_admin_login',
                data: {mobile:mobile},
                dataType: 'json',
                success:function(data){
                    if (data.code != 0) {
                        $('.error_msg').html("<font color='red'>"+data.message+"</font>");
                    }

                    if (data.code == 30001 || data.code == 0) {
                        $('.sendcode').attr("disabled", "disabled");
                        countdown();
                    }
                },
            });
        });

 

相关文章:

  • 2022-12-23
  • 2021-06-12
  • 2023-03-07
  • 2022-01-08
  • 2023-01-07
  • 2021-12-02
  • 2022-01-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-14
  • 2023-01-07
  • 2022-12-23
  • 2021-11-23
  • 2021-10-25
  • 2021-11-08
相关资源
相似解决方案