【问题标题】:IE specific AJAX access issueIE 特定的 AJAX 访问问题
【发布时间】:2012-04-15 09:41:49
【问题描述】:

我在调试 AJAX 请求时遇到问题。 (它是async,因为它是一条隧道)

无论如何,它在 Chrome 和 Firefox 上运行良好,但至少在 IE8/9 中失败。

var responseA = '';

$.ajax({
    type: 'GET',
    url: 'http://pipes.yahooapis.com/pipes/pipe.run?_id=xxxxxx&url=http%3A%2F%2Fwww.rottentomatoes.com%2Fm%2Fthe_hunger_games%2F&_render=json',
    async: true,
    dataType: 'json',
    success: function(text) {
        responseA = text;
    },
    error: function(jqXHR, textStatus, errorThrown) {
        console.log(errorThrown);
    }
});

console.log(responseA);​

errorThrown 抛出LOG: No Transport

我尝试添加$.support.cors = true;

尝试解决任何跨域问题,但现在我得到了

LOG: Error: Access is denied.(仅在 IE 中)提供了什么?

【问题讨论】:

  • 如果要使用跨域AJAX请求,需要指定dataTypejsonp而不是json
  • 我读到这不适用于async

标签: jquery ajax internet-explorer-9 yahoo-pipes


【解决方案1】:

Internet Explorer 8(及以下)不支持 CORS,您必须代理他们的请求(通过同一域中的 PHP 脚本,该脚本调用远程脚本并返回输出)

【讨论】:

    猜你喜欢
    • 2011-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-27
    • 2012-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多