jquery ajax hits error callback before getting response from the server - IE11

孤街醉人 提交于 2019-12-08 00:39:21

问题


I make an async ajax call to the server, but the error callback is hit before getting response from the server (I can see it using fiddler):

$.ajax({
    url: 'Login.aspx/AuthenticateRegularUser',
    type: 'POST',
    contentType: 'application/json; charset=utf-8',
    async: true,
    dataType: "json",
    data: '{ "emailAddress": "' + emailAddress + '","password": "' + password + '","verificationCode": "' + verificationCode + '" }',
    success: function(Result) {
        if (Result != "") {
            var ClientResponse = JSON.parse(Result.d);
            if (ClientResponse.Success) {
        //DO SUCCESS
            }

            else {
        //DO FAIL
            }
        }
    },
    error: function(xhr, textStatus, errorThrown) {
    //DO ERROR
    }
});

It happens only when using IE11.

any ideas why?


回答1:


I'm getting the same error.

For me, Fiddler shows that IE is not even sending the data to the server, and it crashes immediately.

My page does lots of ajax calls, but only one is crashing IE. The data part of the ajax call looks like this:

data: {
        count: 0,
        pid: 0,
        vid: 0,
        invalid: "86ddbe4a-841d-e111-a7fb-002269c41d11"
      },

From the same page, and same code block, this one works fine (the vid is the only difference):

data: {
        count: 0,
        pid: 0,
        vid: 32205,
        invalid: "86ddbe4a-841d-e111-a7fb-002269c41d11"
      },

This works perfectly fine in current Chrome and Firefox browsers, but crashes IE 11.

In tracing through the jquery-2.0.3 code, I can see that data being assigned correctly at line 7186, and at line 7845, hasContent is true and the data has a value, but the call to the server does not have any data in it (as seen via Fiddler).

Line 4362 is the last line in the debugger before the browser crashes with "Internet Explorer has stopped working".




回答2:


I am not sure if it is the same but I am experiencing similar issue I reported here. Check if the conditions are the same (IE11 version, using https iframe inside an http parent window).

IE11 returns status 0 during Ajax POST operation from an iFrame (XMLHttpRequest: Network Error 0x2ee4)



来源:https://stackoverflow.com/questions/20515201/jquery-ajax-hits-error-callback-before-getting-response-from-the-server-ie11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!