formvalidator验证functionvalidate验证表单

2025-10-15 11:59:50

1、引入functionvalidate 响应的js

2、在html表单当中加入《input id=bindPhone type="text">验证的控件

3、$("#bindPhone").formValidator({validatorGroup:"test",onShow:"",onFocus:"内容为空:请输入您注册时绑定的安全手机",onCorrect:"谢谢你的合作"}).inputValidator({min:11,max:11,onError:"格式错误:手机号码格式不正确,请重新输入"}).regexValidator({regExp:"mobile",dataType:"enum",onError:"格式错误:手机号码格式不正确,请重新输入"}).functionValidator({

fun:function(val,elem){

var userAccount = $("#userAccount").val();

if(userAccount !=""){

var str;

$.ajax({     type:"GET", 

async : false,

  url:"check_appeal_userphone.php?t="+Math.random(),

data:{

userAccount:userAccount,

userPhone :val

}, 

dataType:'text',//服务器返回的数据类型 可选XML ,Json jsonp script html text等

success:function(data){

  if(data == "error"){   

  str= "33333333";

}else if(data == "success"){

str= true;

}else{

str= "7576";

}

},

error:function(){

alert("cuowu11-");

}   

});

return str;

}

}

});

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢