使用IE6时,JQGrid POST不包含postData

时间:2012-10-02 16:53:13

标签: javascript wcf jqgrid internet-explorer-6

使用Fiddler2,当使用IE6时,我看到POST请求不包含下面指定的postData。我已验证路径是在JQGrid初始化时定义的。它适用于IE9和Chrome。我正在调用WCF POST服务。调用是在没有参数的情况下进行的,并挂起IE6而没有响应。

任何想法都赞赏!编辑:

最新更新:已解决

问题是我的动态调整大小代码的副作用;我在窗口调整大小事件上调整了网格包装div的大小,不幸的是在IE6中,内容调整大小的气泡直到窗口导致递归。这就像在和我的日记交谈,但也许这会帮助其他人。

好的,我能够通过单独的AJAX调用获取数据(通过Fiddler验证),并使用AddJSONData()方法绑定到网格。调试器在数据类型的末尾弹出:callback function ...但是如果我让它继续执行,那么IE6会挂起。我仍然坚持这个!

                grid.jqGrid({
                datatype: function ()
                {
                    var ts = this,      // - cache 'this' to use later in the complete callback
                    parameters = this.p;         // - cache the grid parameters

                    $("#list")[0].addJSONData(_gridData);

                    if ($.isFunction(parameters.loadComplete))
                        parameters.loadComplete.call(ts, _gridData);

                    if (parameters.loadonce || parameters.treeGrid)
                        parameters.datatype = "local";

                    debugger;
                },

当我可以的时候,匆匆走开。我写了一个测试ajax调用GetData服务方法,它在正文中填充POST数据,并返回所有网格数据。好的,所以JQGrid没有在请求体中设置参数,我是否有JQGrid配置错误?请指教!


在serializeGridData函数中,确实没有得到太多的爱... ..事实证明,JSON2 stringify将postData视为一个字符串?密钥名称周围的引号被转义:

IE6: "{\"path\":\"c:\\Source\\TestUpload\\Uploads\\5ec33030-ab7b-4480-9deb-3153726c1ede.xls\",\"_search\":true,\"nd\":1349365262553,\"rows\":15,\"page\":1,\"sidx\":\"IDNumber\",\"sord\":\"desc\"}"

IE9:  {"path":"c:\\Source\\TestUpload\\Uploads\\3228b61e-4f1b-4ce4-813e-10f58b1b4285.xls","_search":true,"nd":1349365395840,"rows":15,"page":1,"sidx":"IDNumber","sord":"desc"}

好的,所以我使用Fiddler的撰写功能来修改IE6 JQGrid请求,使用有效的会话cookie,只添加POST数据:

{"path":"c:\\Source\\TestUpload\\Uploads\\cb238b83-3c6e-42c2-92be-0e8d08dd905e.xls","_search":true,"nd":1349284471504,"rows":15,"page":1,"sidx":"IDNumber","sord":"desc"}

......它运作得很好。所以出于某种原因,JQGrid没有填充IE6的POST数据?有什么想法吗?


值得注意的是,请求标头中的内容长度是正确的,没有关联的POST数据。我尝试在XMLHttpRequests上在Fiddler中设置断点,并且它没有破坏JQGrid请求;但它确实在之前的AJAX请求中按预期打破了。

这是IE9中成功的jqgrid POST请求的原始标头:

POST http://localhost/Loader.svc/GetData?_=1349274977838 HTTP/1.1
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: application/json
X-Requested-With: XMLHttpRequest
Referer: http://localhost/BulkOrderPersonalized.aspx
Accept-Language: en-US,fr;q=0.5
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host: localhost
Content-Length: 169
Connection: Keep-Alive
Pragma: no-cache
Cookie: ASP.NET_SessionId=qlj50u45mk4f5q55izyj23us;    MerchantV2=BAEE474A47A5264EF3B3C1977173019C569F51792BEA95C1F129634F6B5E8C8475631791B382D7159E78364979FE541B9337D3C5D2B1B0563A653E6DFD738D0D291A9CFADB3555FA4E3D891BD8912D6E0F315A51E61F240F69A6CA061B6CEA17868F9D7E33C36415DEAB3EC9178A9A2748CF002B

{"path":"c:\\Source\\TestUpload\\Uploads\\b7f0ba08-c9f5-46b3-a856-dfa33410be75.xls","_search":true,"nd":1349274977961,"rows":15,"page":1,"sidx":"IDNumber","sord":"desc"}

这是挂起IE6的POST请求的原始标头:

POST http://10.8.8.72/Loader.svc/GetData?_=1349271720318 HTTP/1.1
x-requested-with: XMLHttpRequest
Accept-Language: en-us
Referer: http://10.8.8.72/BulkOrderPersonalized.aspx
Accept: application/json, text/javascript, */*; q=0.01
Content-Type: application/json
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727;     NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Host: 10.8.8.72
Content-Length: 169
Proxy-Connection: Keep-Alive
Pragma: no-cache
Cookie: ASP.NET_SessionId=5fvcrn55mrcjw145ari0h2a1;         MerchantV2=C1EB658057878B9D526DA8216B181011CA53F98BFA7A794AFFFEF7FD855E64C63244EA741FA984FDBB8699787EC387D195474B1D08F1C784E79ECC5C8F16206CE477C91891DC26673015908CBE3C012E10CB8A3DCABDC1762DD10C3D8D15ABC403C454F4231BD16F63787D6E387683F5E99634B5

唯一相关的区别似乎是在使用IE6时JQGrid没有填充POST数据。

之前使用post数据的jQuery AJAX调用在JQGrid绑定之前执行得很好:

function GetRequestConfigs(type, issuingBank) // - get configuration objects for user; (load initially)
{
if (_configurations == null) {

    $.ajax({
        async: false,
        type: 'POST',
        url: 'Loader.svc/GetRequestConfigurations',
        data: '{"type":"' + type + '","issuingBank":"' + issuingBank + '"}',
        dataType: 'json',
        contentType: 'application/json',
        success: function(response, textStatus, xhr) {
            _configurations = JSON.parse(response.d);
        },
        error: function(xhr, textStatus, errorThrown) {
            alert(textStatus);
        }
    });
}
return _configurations;

}

此JQGrid POST请求失败:

grid.jqGrid({
            url: 'Loader.svc/GetData',                  // - webinvoke post method
            postData: { path: path },

            search: true,
            datatype: 'json',
            mtype: 'POST',
            loadonce: true,                             // - load data once on server side, then switch to local data handling
            ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },

            serializeGridData: function (postData)      // - process returned object from web-invoke to json
            {
                return JSON.stringify(postData);
            },

            jsonReader: {                                       // - map json to grid elements ( this is how the grid expects the data from the server )
                root: function (obj) { return obj.d.rows; },
                page: function (obj) { return obj.d.page; },
                total: function (obj) { return obj.d.total; },
                records: function (obj) { return obj.d.records; }
            }, ...

0 个答案:

没有答案