相关疑难解决方法(0)

请求的资源错误上没有"Access-Control-Allow-Origin"标头

我正在尝试获取新闻网站的Feed.我以为我会使用google的feed API将feedburner Feed转换为json.以下网址将以json格式从Feed返回10个帖子.http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&q=http://feeds.feedburner.com/mathrubhumi

我使用以下代码来获取上面的url的内容

$.ajax({
  type: "GET",
  dataType: "jsonp",
  url: "http://ajax.googleapis.com/ajax/services/feed/load",
  data: {
    "v": "1.0",
    "num": "10",
    "q": "http://feeds.feedburner.com/mathrubhumi"
  },
  success: function(result) {
    //.....
  }
});
Run Code Online (Sandbox Code Playgroud)

但它没有工作,我收到以下错误

XMLHttpRequest无法加载 http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&q=http%3A%2F%2Ffeeds.feedburner.com%2Fmathrubhumi.请求的资源上不存在"Access-Control-Allow-Origin"标头.原产地" :HTTP //本地主机,因此"是不允许访问.

我该如何解决?

javascript ajax jquery json cors

89
推荐指数
3
解决办法
44万
查看次数

标签 统计

ajax ×1

cors ×1

javascript ×1

jquery ×1

json ×1