我正在使用 jGFeed 来解析 RSS Feed,我的代码如下:
$.jGFeed('http://feeds.bbci.co.uk/news/rss.xml',
function(feeds){
// Check for errors
if(!feeds){
// there was an error
return false;
}
// do whatever you want with feeds here
$('#newsTimeline').empty();
for(var i=0; i<feeds.entries.length; i++){
var entry = feeds.entries[i];
var title = entry.title;
var description = entry.description;
var linkUrl = entry.link_url;
var date = getDate(entry.pubDate);
var time = getTime(entry.pubDate);
$('#newsTimeline').append('<li><time class="cbp_tmtime" datetime="'+date+' '+time+'"><span>'+date+'</span> <span>'+time+'</span></time><div class="cbp_tmicon cbp_tmicon-phone"></div><div class="cbp_tmlabel"><h2>'+title+'</h2><p>'+description+'</p></div></li>');
}
}, 10);
问题是它适用于 entry.title,但之后没有任何效果:
注意:Javascript 控制台中不会记录任何错误。