Jquery邮箱发送验证码时显示倒计时(附源码)
在做网站时不管用什么方式发送验证码,一般都需要显示一下N秒后重新发送验证码,下面是我用Jquery写的一个小实例,直接拿过去就能用
//发送验证码 var sendstatus = true; $("#sendCode").click(function () { var _this = $(this); if(sendstatus){ var email = $("input[name=email]").val(); $.post('/xxxx/', {email: email}, function (data) { if (data.status) { _this.html('120秒重发'); sendstatus = false; sendtime = 120; sendevent = setInterval(function(){ if(sendtime>0){ sendtime--; _this.html(sendtime+'秒重发'); } else { sendstatus = true; _this.html('发送验证码'); clearInterval(sendevent); } },1000); } }); } });
文章版权声明
1、本网站名称:阿V编程
2、本站永久网址:https://www.1892zyw.com
3、本网站的部分文章内容/部分资源可能来源于网络,仅提供给大家学习或参考,如有侵权,请联系站长QQ进行删除处理。
4、本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
5、本站一律禁止以任何方式发布或转载任何违法的相关信息,如有发现请向站长举报