Created
March 19, 2009 20:33
-
-
Save rmasters/82035 to your computer and use it in GitHub Desktop.
Using the Google Feeds API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the feeds library, version 1 | |
google.load("feeds", "1"); | |
// Callback function | |
function initialize() { | |
// The feed we want to load | |
var feed = new google.feeds.Feed("http://www.digg.com/rss/index.xml"); | |
// Load the feed | |
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); | |
} | |
} | |
}); | |
} | |
// Set the callback function | |
google.setOnLoadCallback(initialize); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment