简体   繁体   English

jquery.form和jquery.validate:IE中没有提交POST数据

[英]jquery.form & jquery.validate: No POST data submitted in IE

When users submit my from in IE8, with or without compatibility mode, the form does the AJAX call, but no POST data is sent. 当用户在具有或不具有兼容模式的IE8中从中提交我的信息时,该表单会进行AJAX调用,但不会发送POST数据。 Below is my jQuery.validate and jQuery.form code: 下面是我的jQuery.validate和jQuery.form代码:

var v = jQuery("#enterfrm").validate({
        submitHandler: function(form) {
            jQuery(form).ajaxSubmit({
                target: "#result",
                success: function() {
                    $("#enterfrm").hide();
                }
            });
        },
        debug: true,
        rules: {
            reportto: {
                required: true
            },
            jobtitle: {
                required: true
            },
            dept: {
                required: true
            },
            paystatus: {
                required: true
            },
            reason: {
                required: true
            },
            prefstartdate: {
                required: true
            },
            sthour: {
                required: true
            },
            edhour: {
                required: true
            },
            jbdescex: {
                required: true
            },
            positionchg: {
                required: true
            },
            minexp: {
                required: true
            },
            adrecreq: {
                required: true
            },
            comsug: {
                required: false
            },
            org: {
                required: true
            },
            origemail: {
                required: true
            },
            // //
            replacing: {
                required: function(element) {
                    return $("#reason").val() == "Replacement";
                }
            },
            replacetitle: {
                required: function(element) {
                    return $("#reason").val() == "Replacement";
                }
            },
            justify: {
                required: function(element) {
                    return $("#reason").val() == "New Position";
                }
            },
            length: {
                required: function(element) {
                    return $("#paystatus").val() == "Temporary - In House" || $("#paystatus").val() == "Temporary - Outside";
                }
            },
            purpose: {
                required: function(element) {
                    return $("#jbdescex").val() == "No" || $("#positionchg").val() == "Yes";
                }
            },
            duties: {
                required: function(element) {
                    return $("#jbdescex").val() == "No" || $("#positionchg").val() == "Yes";
                }
            },   
            sthour: {
                required: true,
                minlength: 4,
                maxlength: 8
                //notEqTime: true
            },
            edhour: {
                required: true,
                minlength: 4,
                maxlength: 8 //,
                //notEqTime: true
            }
        }
    });

And here is what FireBug Lite captures: 这是FireBug Lite捕获的内容:

ResponseHeaders
Date Mon, 17 Jan 2011 13:56:25 GMT
Server Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.12 with Suhosin-Patch mod_perl/2.0.2 Perl/v5.8.8
X-Powered-By PHP/5.2.4-2ubuntu5.12
Keep-Alive timeout=15, max=100
Connection Keep-Alive
Transfer-Encoding chunked
Content-Type text/html

RequestHeaders
Content-Type application/x-www-form-urlencoded
X-Requested-With XMLHttpRequest
Accept */* 

There is nothing under the POST tab. POST选项卡下没有任何内容。 This all works fine in Firefox, Chrome, and IE with Chrome Frame. 在Firefox,Chrome和带有Chrome浏览器内嵌框架的IE中,这一切都可以正常工作。 Am I missing something as far as the problem is concerned? 就问题而言,我是否错过了什么?

EDIT I have tried this with a GET request as well now and that does not work either. 编辑我现在也尝试过使用GET请求进行操作,但这也不起作用。

looks like jQuery.Form uses $.param(a) to serialize the form, I've only had success getting IE to create proper POST Data with $.param(a, true) See here. 看起来像jQuery.Form使用$.param(a) .param $.param(a)来序列化表单,我只成功地使IE使用$.param(a, true)创建正确的POST数据。请参见此处。 http://api.jquery.com/jQuery.param/ http://api.jquery.com/jQuery.param/

You can use traditional serialization globally by doing $.ajaxSettings.traditional = true; 您可以通过执行$.ajaxSettings.traditional = true;全局使用传统序列化$.ajaxSettings.traditional = true;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM