zoukankan      html  css  js  c++  java
  • 获取验证码

     

    验证码倒计时函数

        var wait = 60;

                                function time(o) {

                                       if(wait == 0) {

                                              o.removeAttribute("disabled");

                                              o.value = "获取验证码";

                                              wait = 60;

                                       } else {

                                              o.setAttribute("disabled", true);

                                              o.value = "重新发送(" + wait + ")";

                                              o.style.backgroundColor = '';

                                              wait--;

                                              setTimeout(function() {

                                                            time(o)

                                                     },

                                                     1000)

                                       }

                                }

           $("#btn").click(function(){

                         phone1 = $("#phone1").val();

                         if(checkPhone(phone1)){

                                time(this);

                                $.ajax({

                                       url: "http://ezist.cn/api/verificationCodes",

                                 type: 'post',

                                 dataType: "json",

                                 data: {tel:phone1,verify:'true'},

                                 success: function(data) {

                                              mui.toast("验证码已发送,请注意查收。");

                                              mes = data.verification_key;

                                 },

                                 error: function (data) {

                                     mui.toast("验证码请求失败");

                                 }

                                });

                         }

                  })

  • 相关阅读:
    MySQL百万级、千万级数据多表关联SQL语句调优
    不就是SELECT COUNT语句吗,居然有这么多学问
    分布式锁讲解
    Java 中堆和栈的区别
    Java中的回调机制
    在Eclipse上Maven环境配置使用
    项目忽然出现 The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path 解决方法
    HttpServletResponse
    com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.
    深入浅出java常量池
  • 原文地址:https://www.cnblogs.com/onesea/p/13689880.html
Copyright © 2011-2022 走看看