请问老师为什么GET请求成功,POST请求不成功呢

来源:2-2 基本验证方法(romote远程校验)

Rhinel

2015-06-09 23:27

按照老师设置一模一样的代码,但是post请求是内部服务器错误http://img.mukewang.com/557705a7000113ea12730662.jpg

写回答 关注

4回答

  • 694473412
    2016-08-01 23:03:57

    我这里修改你的代码的url,method类型是post,说明代码是没问题的。可以检查下是否是服务器的问题

  • Rhinel
    2015-06-10 00:11:22

    json的

    true


  • Rhinel
    2015-06-10 00:10:05
    <!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>


  • chavin
    2015-06-09 23:47:52

    上代码看一下

    Rhinel

    上了、、

    2015-06-10 00:11:52

    共 1 条回复 >

jQuery插件——Validation Plugin

validation让客户端表单验证变容易,缩短用户等待时间

65871 学习 · 216 问题

查看课程

相似问题