Jquery Ajax call works in all browser except ie 10

2019-01-19 21:54发布

The following ajax call works in all browsers except IE10 (unless i set it to IE9 standards mode) I look at it with fiddler and it seems as if the paramater isn't being passed through in ie10 any ideas?

var paramArray = '{"ID":1}';   

 $.ajax({
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        url: '/assets/services/coreWebServices.svc/GetCategoriesWithoutColumns',
        data: paramArray,
        success: successFn,
        error: errorFn
    });

throws the following error

The OperationFormatter could not deserialize any information from the Message because the Message is empty (IsEmpty = true).
    at System.ServiceModel.Dispatcher.PrimitiveOperationFormatter.DeserializeRequest(Message message, Object[] parameters)

System.Runtime.Serialization.SerializationException: Error in deserializing body of request message for operation 'GetCategoriesWithoutColumns'. The OperationFormatter could not deserialize any information from the Message because the Message is empty (IsEmpty = true).
    at System.ServiceModel.Dispatcher.PrimitiveOperationFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.CompositeDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

System.ServiceModel.CommunicationException: Error in deserializing body of request message for operation 'GetCategoriesWithoutColumns'. The OperationFormatter could not deserialize any information from the Message because the Message is empty (IsEmpty = true).
    at System.ServiceModel.Dispatcher.PrimitiveOperationFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.CompositeDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)\u000d\u000a
    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)\u000d\u000a
    at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

5条回答
姐就是有狂的资本
2楼-- · 2019-01-19 22:08

Sending data per POST in an ajax request does not work in IE10 (even if in my case no additional programmes are installed which could interfere with IE10). Sending data per GET in an ajax request instead works for me.

At first according to the JavaScript error console this seemed to be a jquery problem and a problem with JSON data (like wrong encoding or illegal characters or invalid json), respectively, when sending back json data in the response, but all was fine with the json data. Then I recognized that POST data are not sent and I changed the "type" parameter in the jquery $.ajax call to "GET", which fixed the problem.

查看更多
太酷不给撩
3楼-- · 2019-01-19 22:15

This seems to be a bug in jQuery with IE10 (at least the Windows 7 preview release). The POST data does not get sent in the request, I have logged details of the bug to jQuery: http://bugs.jquery.com/ticket/12790#comment:18

UPDATE: In my case it was a bug in Free Download Manager that caused a problem in IE10. They have fixed the issue (3.9.2 build 1281. - Dec 26, 2012) so that it plays nice. If you read the comments in the jQuery link above you can see that someone picked that up too and uninstalling FDM corrected the issue as well. So it's not a problem of IE10 or jQuery, but rather an add-on altering the normal behavior.

查看更多
Anthone
4楼-- · 2019-01-19 22:17

I know this question was asked a long time back but wanted to add my answer.

This is not a bug of IE or jquery. Some download manager like DAP, FDM and IDM is responsible for this issue(even when disabled). Removing these download manager would work.

The issue is that these download manager has an incomplete thunk of some URLMon interfaces, and this interferes with POST uploads.

Few guys also have reported that Google Gears is also responsible for this issue. After disabling, the issue will resolve.(Not tested)

查看更多
时光不老,我们不散
5楼-- · 2019-01-19 22:20

In my case, Download Accelerator Plus was the cause. Uninstalling DAP resolved the issue.

查看更多
Anthone
6楼-- · 2019-01-19 22:20

I hit the same problem with an Ajax POST request of a FormData object in IE10/jQuery 1.11.1. Neither the POST data nor the file attachments were sent to the server. Only the URL parameters were sent.

I was using this patch to add a progress callback to jQuery Ajax:

https://github.com/englercj/jquery-ajax-progress

Without the patch the request works perfectly in IE10.

The patch works perfectly in all other browsers.

查看更多
登录 后发表回答