标签:tco open 验证 发送 function return pen index ssm
var isSmsSend = false;
function clickButtona(obj){
var obj = $(obj);
var mobile=$("input[name=mobile]").val();
var URL1 = "{:url('member/index/getcode')}";
if(isSmsSend == false){
isSmsSend = true;
$.ajax({
url: URL1,
type: 'post',
data:{mobile:mobile},
success: function(data) {
if(data.error>0){
isSmsSend = false;
layer.open({
content: data.msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
return false;
}else{
layer.open({
content: "验证码已发送,请注意查收"
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
obj.attr("disabled","disabled");/*按钮倒计时*/
var time = 60;
var set = setInterval(function(){
if(time >= 0){
obj.val(time+"(s)");
}else{
isSmsSend = false;
clearInterval(set);
obj.attr("disabled",false);
obj.val("重新发送");
}
time--;
}, 1000);/*等待时间*/
}
}
});
}
}
标签:tco open 验证 发送 function return pen index ssm
原文地址:https://www.cnblogs.com/lalalagq/p/10203148.html