0

我正在使用 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 控制台中不会记录任何错误。

4

1 回答 1

3

尝试这个

       for(var i=0;i<feeds.entries.length;i++){
            var entry = feeds.entries[i];
            var title = entry.title;
            var linkUrl= entry.link;
            var description = entry.contentSnippet;
            var date = entry.publishedDate;
            $('#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>');
            }
于 2013-07-27T07:28:58.080 回答