连续点击ajax 防止多次提交
var isAjax=false; $('#count_down').click(function(){ if(isAjax){ return; } isAjax=true; var _phone = $('#phone_number').val(); if(_phone == ''){ isAjax=false; alert('手机号不能为空');return; }else if(_phone.length !== 11){ isAjax=false; alert('请输入正确位数手机号');return; } $.ajax({ type:'post', url:"{:U('Login/send_sms')}", data:{phone:_phone,type:1}, success:function(data){ if(data.status == 'ok'){ alert(data.content);return isAjax=false; }else{ isAjax=false; alert(data.content);return } } }); });