试图访问机箱

时间:2011-03-25 16:28:56

标签: jquery jquery-plugins rss

我正在尝试从jQuery和jGFeed插件访问RSS机箱。这是我的剧本:

<script type="text/javascript">
$(document).ready(function() {

    $.jGFeed('http://feeds.feedburner.com/solidverbal', function(feeds){
        // Check for errors
        if(!feeds){
        // there was an error
        return false;
        }
        // do whatever you want with feeds here
        var t = "";
        for(var i=0; i<feeds.entries.length; i++){
            var entry = feeds.entries[i];
            // Entry title
            console.log(entry);
            t = t + "<li><a href='"  + entry.mediaGroups + "'>" + entry.title + "</a><br/>" + entry.content + "</li>";
        }
        $("#results").html("<ul>" + t + "</ul>");

    }, 10);
});
</script>

如何访问此内容?当它转换为JSON时,机箱会显示在“mediaGroups”对象中?有人可以帮我查看这些网址吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

您可以将feeds JSON发送到另一个函数进行操作:

        if(!feeds){
          // there was an error
          return false;
        }
        // do whatever you want with feeds here
        feedsFunction(feeds);
        var t = "";
        for(var i=0; i<feeds.entries.length; i++){
            var entry = feeds.entries[i];
            // Entry title
            console.log(entry);
            t = t + "<li><a href='"  + entry.mediaGroups + "'>" + entry.title + "</a><br/>" + entry.content + "</li>";
        }
        $("#results").html("<ul>" + t + "</ul>");