jquery - 使用 jQuery 读取 RSS 提要?

标签 jquery jquery-plugins rss xml-parsing rss-reader

使用 jQuery rss 插件 jFeed ,并使用他们网站上的示例代码,我创建了以下似乎不起作用的代码:

jQuery.getFeed({
    url: 'http://www.hotukdeals.com/rss/hot',
    success: function(feed) {
        alert(feed.title);
    }
});

我收到一条消息:

XMLHttpRequest cannot load http://www.hotukdeals.com/rss/hot. Origin http://intranet is not allowed by Access-Control-Allow-Origin.

有人知道我为什么收到此访问控制消息吗?此 RSS 提要在我的桌面和在线 RSS 阅读器中运行良好...

最佳答案

警告

The Google Feed API is officially deprecated and doesn't work anymore!

无需插件即可轻松完成,并且返回的数据为 json

        $(function(){
        url = 'http://www.thetutlage.com/rss.xml';
        $.ajax({
        type: "GET",
        url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&callback=?&q=' + encodeURIComponent(url),
        dataType: 'json',
        error: function(){
            alert('Unable to load feed, Incorrect path or invalid feed');
        },
        success: function(xml){
            values = xml.responseData.feed.entries;
            console.log(values);
        }
    });
    });

只需确保它指向 xml 文件并将 url 更改为 url Rss feed,

关于jquery - 使用 jQuery 读取 RSS 提要?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11346990/

相关文章:

javascript - knockoutjs 单击绑定(bind)在嵌套的 foreach 中不起作用

javascript - 是否有一个 jquery 插件来剪切长列标题?

php - SQLITE 按日期排序忽略年份

javascript - hasClass 不起作用

javascript - 特定于每个页面的 jQuery Mobile 单独加载消息

javascript - 使用 jQuery 使文本淡入淡出

JQuery 插件结构。带有选项的方法、方法和选项

javascript - 如何检查 jQuery 插件和函数是否存在?

c - 尝试访问机场 RSS 提要时获取 'access denied'

php - 网站上的个性化 RSS 源