This Forum has been archived there is no more new posts or threads ... use this link to report any abusive content
==> Report abusive content in this page <==
Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I put this BBC NEWS feed on to my website?
06-02-2014, 11:12 AM
Post: #3
 
Adapted from....

https://code.google.com/apis/ajax/playground/#load_feed



/*
* How to load a feed via the Feeds API.
*/

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

// Our callback function, for when a feed is loaded.
function feedLoaded(result) {
if (!result.error) {
// Grab the container we will put the results into
var container = document.getElementById("content");
container.innerHTML = '';

// Loop through the feeds, putting the titles onto the page.
// Check out the result object for a list of properties returned in each entry.
// http://code.google.com/apis/ajaxfeeds/do....html#JSON
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);
}
}
}

function OnLoad() {
// Create a feed instance that will grab Digg's feed.
var feed = new google.feeds.Feed("http://feeds.bbci.co.uk/news/world/rss.xml");

// Calling load sends the request off. It requires a callback function.
feed.load(feedLoaded);
}

google.setOnLoadCallback(OnLoad);​
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[] - Steve N - 06-02-2014, 11:00 AM
[] - Duncan - 06-02-2014 11:12 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)