Inbal
Inbal

Reputation: 929

IPAD NETWORK_ERR: XMLHttpRequest Exception 101 using safari and chrome on jquery ajax call

I make an ajax call to my server in order to get data:

function LoadWebViewFile() {
    var currentURL = null;
    $.ajax({
        url: 'Default.aspx/LoadWebViewFile',
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        async: false,
        dataType: "json",
        data: '{ "FileID": "' + Documents.getSelectedID() + '" }',
        success: function(Result) {
            var ClientResponse = JSON.parse(Result.d);
            if (ClientResponse.Success) {
                currentURL = ClientResponse.Data;

            }

            else {
                showPopUpDialog('indicator', {
                    message: ClientResponse.Message,
                    type: 'error'
                }, false);
            }
        },
        error: function(xhr, textStatus, errorThrown) {
            alert(xhr.responseText);
            alert("An AJAX error occured: " + textStatus + "\nError: " + errorThrown);

            showPopUpDialog('indicator', {
                    message: 'An error occured while trying to load the file',
                    type: 'error'
                }, false);
        }
    });

    return currentURL;
}

It works fine on PC (ie, chrome), but fails on Safari and chrome when using an IPAD and the data is big (means it takes more time on server side).

The error I get is:

NETWORK_ERR: XMLHttpRequest Exception 101

and I don't know why... I can't change async to false because nothing works.

Upvotes: 2

Views: 3311

Answers (1)

joeriks
joeriks

Reputation: 3462

IOS webengine reports 10 sec timeouts on ajax requests as error 101. I got lots of headache because of that.

And if you're calling your data synchronously it seems you're out of luck. Either make the server respond within 10 secs, or change to async and add a timeout.

See also http://propercode.com/?p=32

Upvotes: 3

Related Questions