Return to Snippet

Revision: 47226
at June 3, 2011 00:11 by olemedia


Initial Code
//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"></script>
<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.

Initial URL
http://stackoverflow.com/questions/2323041/how-to-dynamically-read-rss-using-jquery

Initial Description

                                

Initial Title
how to dynamically read RSS using jquery

Initial Tags
jquery

Initial Language
jQuery