1.获取前端验证码按钮值
$('#dyMobileButton').click(function () {
var phone=$('#phone').val();
var time=60;//产生一个时间60秒
var timer=setInterval(function () {//setInterval倒计时
time--;
if (time>0){
$('#dyMobileButton').html(time+'后重新发送');
$('#dyMobileButton').prop('disabled',true);//开启禁用此按钮
}else{
clearInterval(timer);//清除计时任务
$('#dyMobileButton').html('发送验证码');
$('#dyMobileButton').prop('disabled',false);//disabled禁用
}
},1000)
$.ajax({
url:"{:url('/code')}",
type:"GET",
data:{"phone":phone},
dataType:"json",
success:function (res) {
console.log(res)
}
})
})