【问题标题】:AJAX call working in Chrome but not IEAJAX 调用在 Chrome 中工作,但在 IE 中不工作
【发布时间】:2014-04-10 15:39:57
【问题描述】:

尝试从生成网页底部 3 个数字的 url 获取 json 数据。我的 ajax 调用在 Google chrome 中有效,但在 Internet Explorer 中无效。经过研究,我被告知我需要使用 cache: false 禁用缓存,但这并没有解决问题。

这里是 jsfiddle 上的源代码,其中有一个成功的 ajax 调用。但是我的代码无法在 Internet Explorer 上运行。

http://jsfiddle.net/c2VeD/148/

var url = 'http://crudwebappmavenized.ncsu.cloudbees.net/stats'

$.ajax(url, {

type: 'GET',
crossDomain: true,
dataType: 'json',
contentType: 'application/json',
cache: false,
success: function (result)

【问题讨论】:

  • 哪个 IE 版本失败了?
  • 什么版本的IE,你启用了CORS等
  • Internet Explorer 版本 11

标签: javascript jquery ajax internet-explorer


【解决方案1】:

IE7 及更早版本不支持跨域,在 IE8 或更高版本需要查看此页面“安全性:跨域和区域策略”http://msdn.microsoft.com/en-us/library/ms537505%28VS.85%29.aspx

编辑

检查这个答案:

Jquery $.ajax fails in IE on cross domain calls

【讨论】:

    猜你喜欢
    • 2014-05-24
    • 2017-07-21
    • 1970-01-01
    • 2023-03-05
    • 2020-01-23
    • 1970-01-01
    • 2015-02-12
    • 2018-02-14
    • 1970-01-01
    相关资源
    最近更新 更多