请问一下,我的这个remote远程校验怎么不能用?
我在我的remote.json里面是写的true,为什么鼠标移开不能提交,没有提交数据?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jQuery Validation 插件</title>
</head>
<style>
body{font-size:36px; line-height:1.6}
p{margin:10px 0;}
label{display:inline-block; min-width:140px;}
label.error{margin-left:10px;color:red;}
input,button{line-height:35px; border:1px solid #999; min-width:180px; font-size:36px;}
input.error{border:1px solid red;}
input[type=submit],button{margin-top:20px; font-size:36px; padding:10px 0;}
</style>
<body>
<form action="" id="demoForm">
<fieldset>
<legend>用户登录</legend>
<p>
<label for="">用户名</label>
<input type="text" id="username" name="username">
</p>
<p>
<label for="">密码</label>
<input type="password" id="password" name="password">
</p>
<p>
<input type="submit" value="登录">
</p>
</fieldset>
</form>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
<script src="jquery-validation-1.15.0/dist/jquery.validate.js"></script>
<script>
$(document).ready(function() {
$("#demoForm").validate({
debug:true,
rules:{
username:{
required:true,
minlength:2,
maxlength:10,
remote:"remote.json",
},
password:{
required:true,
minlength:2,
maxlength:16,
},
},
messages:{
username:{
required:"必须填写用户名",
minlength:"用户名最小为2位",
maxlength:"用户名最大为10位",
},
password:{
required:"必须填写密码",
minlength:"密码最小为2位",
maxlength:"密码最大为16位",
},
}
});
});
</script>
</body>
</html>
相关分类