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

                                 }

                                });

                         }

                  })

  • 相关阅读:
    搭建Git本地服务器
    shutdown,init,halt,poweroff,reboot的区别和联系, pkill -kill -t tty7注销
    RHEL/CentOS/Fedora常用的 CentOS 5/6/7 yum 源(EPEL、Remi、RPMForge、RPMFusion, ius,163,sohu,阿里云)配置
    国内的一些开源镜像站汇总,EPEL源
    EditPlus 配置 Java & C/CPP 开发环境
    Nginx+Keepalived 做负载均衡器
    监控Nginx负载均衡器脚本
    Heartbeat+DRBD+NFS 构建高可用的文件系统
    数据库索引的作用和长处缺点
    【ThinkPHP学习】ThinkPHP自己主动转义存储富文本编辑器内容导致读取出错
  • 原文地址:https://www.cnblogs.com/deng-jie/p/9104264.html
Copyright © 2011-2022 走看看