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("验证码请求失败");

                                 }

                                });

                         }

                  })

  • 相关阅读:
    理解内存对齐
    Nodejs koa2读取服务器图片返回给前端直接展示
    nodejs koa2 设置 静态资源目录
    把 nodejs koa2 制作的后台接口 部署到 腾讯云服务器
    nodejs 更改项目端口号的 方法
    简单实现 nodejs koa2 mysql 增删改查 制作接口
    java对象的序列化以及反序列化详解
    springboot对LocalDateTime类型入参和接口返回值格式化
    js 正则exec()函数在循环中使用
    centeros 7 忘记root密码,重置
  • 原文地址:https://www.cnblogs.com/onesea/p/13689880.html
Copyright © 2011-2022 走看看