我想知道如何使用 jquery 解析 Atom feed。
我的提要网址如下
http://www.google.co.in/trends/hottrends/atom/hourly
下面是 jsfiddle,但它不起作用
最佳答案
要发出跨浏览器请求,请参阅我在评论中指出的链接。
您可以使用此代码:
<script src="jquery.js"></script>
<script src="jquery.jgfeed.js"></script>
<script>
$.jGFeed('http://twitter.com/statuses/user_timeline/26767000.rss',
function(feeds){
// Check for errors
if(!feeds){
// there was an error
return false;
}
// do whatever you want with feeds here
for(var i=0; i<feeds.entries.length; i++){
var entry = feeds.entries[i];
// Entry title
entry.title;
}
}, 10);
</script>
不要忘记包含 Google Feeds API 插件 (jquery.jgfeed.js)
关于jquery - 如何使用 jquery 解析 Atom feed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7554906/