views:

195

answers:

2

hello.

i want to read multiple RSS feeds using jquery, i'm trying to write a flexible function that will just take the RSS URL and it will output only its TITLE AND IMAGE how to do that for multiple RSS URLs ?

A: 

Have you seen this JQuery plug-in: http://plugins.jquery.com/project/jFeed

Ronald
+1  A: 

The easiest way would be to use the Google AJAX Feed API. They have a really simple example, which suits what you want nicely:

<script type="text/javascript" src="http://www.google.com/jsapi"&gt;&lt;/script&gt;
<script type="text/javascript">

google.load("feeds", "1");

function initialize() {
  var feed = new google.feeds.Feed("http://www.digg.com/rss/index.xml");
  feed.load(function(result) {
    if (!result.error) {
      var container = document.getElementById("feed");
      for (var i = 0; i < result.feed.entries.length; i++) {
        var entry = result.feed.entries[i];
        var div = document.createElement("div");
        div.appendChild(document.createTextNode(entry.title));
        container.appendChild(div);
      }
    }
  });
}
google.setOnLoadCallback(initialize);

</script>
<div id="feed"></div>

Of course, you can mix jQuery with the API instead of using native DOM calls.

Brian McKenna