【问题标题】:Why calling RSS feeds from ajax not working?为什么从 ajax 调用 RSS 提要不起作用?
【发布时间】:2015-07-25 15:25:08
【问题描述】:

我正在尝试编写this RSS 足球提要。

但是当我调用它时,它会出现如下错误

XMLHttpRequest 无法加载http://ibnlive.in.com/ibnrss/rss/sports/football.xml

请求的资源上不存在“Access-Control-Allow-Origin”标头。

Origin 'http://localhost:8888' 因此不允许访问。

我的电话有什么问题?

我的通话代码如下

$.ajax({
    type: "GET",
    url: "http://ibnlive.in.com/ibnrss/rss/sports/football.xml",
    dataType: "xml",
    success: xmlParser
});

function xmlParser(xml){
    console.log(xml);

    var xmlcode='';

    $(xml).find('item').each(function(){
        xmlcode+="<li>"+$(this).find('title').text()+"</li>";
    });

    $('.headline-ul').html(xmlcode);
}

使用该字段还需要其他什么吗?

【问题讨论】:

    标签: jquery ajax xml rss


    【解决方案1】:
    猜你喜欢
    • 1970-01-01
    • 2015-08-14
    • 1970-01-01
    • 1970-01-01
    • 2013-11-16
    • 1970-01-01
    • 2021-10-11
    • 1970-01-01
    相关资源
    最近更新 更多