formvalidator
引入functionvalidate 响应的js
在html表单当中加入《input id=bindPhone type='text'>验证的控件
$('#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;}}});
js的ajax使用
jquery用法