【问题标题】:IPAD NETWORK_ERR: XMLHttpRequest Exception 101 using safari and chrome on jquery ajax callIPAD NETWORK_ERR: XMLHttpRequest Exception 101 在 jquery ajax 调用上使用 safari 和 chrome
【发布时间】:2013-10-20 10:08:07
【问题描述】:

我对我的服务器进行 ajax 调用以获取数据:

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;
}

它在 PC 上运行良好(即 chrome), 但在 Safari 和 chrome 上使用 IPAD 时会失败,并且数据很大(意味着在服务器端需要更多时间)。

我得到的错误是:

NETWORK_ERR:XMLHttpRequest 异常 101

我不知道为什么... 我无法将 async 更改为 false,因为没有任何效果。

【问题讨论】:

    标签: ajax ipad jquery safari


    【解决方案1】:

    IOS webengine 将 ajax 请求的 10 秒超时报告为错误 101。因此我很头疼。

    如果您正在同步调用您的数据,那么您似乎就不走运了。要么让服务器在 10 秒内响应,要么改为异步并添加超时。

    另见http://propercode.com/?p=32

    【讨论】:

      猜你喜欢
      • 2012-04-01
      • 2013-04-01
      • 1970-01-01
      • 2018-11-21
      • 1970-01-01
      • 1970-01-01
      • 2011-02-10
      • 1970-01-01
      • 2012-02-08
      相关资源
      最近更新 更多