按照老师设置一模一样的代码,但是post请求是内部服务器错误
我这里修改你的代码的url,method类型是post,说明代码是没问题的。可以检查下是否是服务器的问题
json的
true
<!DOCTYPE html> <head> <title>表单验证插件</title> <meta charset="utf-8" /> <style> #divtest { width: 282px; } #divtest .title { padding: 8px; background-color: blue; color: #fff; height: 23px; line-height: 23px; font-size: 15px; font-weight: bold; } #divtest .content { padding: 8px 0px; background-color: #fff; font-size: 13px; } #divtest .content .tip { color: Red; font-size: 12px; } .fl { float: left; } .fr { float: right; } </style> <script type="text/javascript" src="http://www.imooc.com/data/jquery-1.8.2.min.js"></script> <script type="text/javascript" src="http://www.imooc.com/data/jquery.validate.js"></script> <script type="text/javascript" src="http://www.imooc.com/data/jquery.validate.messages_cn.js"></script> </head> <body> <form id="frmV" method="get" action="#"> <div id="divtest"> <div class="title"> <span class="fl">表单验证插件</span> <span class="fr"> <input id="btnSubmit" type="submit" value="提交" /> </span> </div> <div class="content"> <span class="fl">邮箱:</span><br /> <input id="email" name="email" type="text" /><br /> <input name="passname" type="text" /><br /> <input name="password" type="password" /><br /> <span class="tip"></span> </div> </div> </form> <script type="text/javascript"> $(function () { $("#frmV").validate( { /*自定义验证规则*/ rules: { email:{ required:true, email:true }, passname:{ required:true, rangelength:[2,10], remote:{ url:"remote.json", type:"post", data:{ logintime:function(){ return + new Date(); } } } } } } ); }); </script> </body> </html>
上代码看一下