表单里面的提交按钮:

<td align="" class="d"><a href="javascript:void(0)" class="submit" onclick="return sub1()">确认提交</a></td>

ajax验证手机号码的不能重复:
//核对手机号码的唯一
function check_unique(){
var phone = document.getElementById('phone').value;
var flag=true;
$.ajax({
type: 'POST',
url: 'admin/check_phone_unique.php',
data: {phone:phone},
dataType: 'json',
async:false, ----------(加个它,能改变flag的值)
success: function(data){
//console.log(data.status);
if(data.status==1){
alert('手机号码已占用!');
$("#phone").focus();
flag=false;
}
}
});
return flag;
}

验证是否通过,然后提交表单:
if(checkMobile(phone)&&isChinaOrNumbOrLett(name)&&check_unique())

注:红色标注的,很重要,否则,改变不了flag的值

相关文章:

  • 2021-09-27
  • 2022-12-23
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-12-12
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
相关资源
相似解决方案