osh*_*nen 8 rss jquery jquery-plugins xml-parsing rss-reader
使用jQuery rss插入jFeed,并在他们的网站上使用他们的示例代码,我创建了以下代码似乎不起作用:
jQuery.getFeed({
url: 'http://www.hotukdeals.com/rss/hot',
success: function(feed) {
alert(feed.title);
}
});
Run Code Online (Sandbox Code Playgroud)
我收到一条消息说:
XMLHttpRequest cannot load http://www.hotukdeals.com/rss/hot. Origin http://intranet is not allowed by Access-Control-Allow-Origin.
Run Code Online (Sandbox Code Playgroud)
任何人都知道为什么我得到这个访问控制消息?这个rss feed在我的桌面和在线RSS阅读器中运行良好...
Ama*_*irk 31
警告
Google Feed API已正式弃用,不再有效!
没有插件就可以很容易地完成它,返回的数据将在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);
}
});
});
Run Code Online (Sandbox Code Playgroud)
只需确保它指向xml文件并将url更改为url Rss feed,