Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<script type="text/javascript" src="">
<script type="text/javascript">
//Routine to display the items of an RSS feed in a web page
// The output is attached to a uniquely identified HTML item
// The URL of the RSS feed you want to display
var url='';
//The id of the HTML element you want to contain the displayed feed
var containerID="test";
// The gubbins...
function cross_domain_JSON_call(url){
// url points to an RSS feed
// displayOutput(url);
//fetch the feed from the address specified in 'url'
// then call "myCallbackFunction" with the resulting feed items
function(data) { myCallbackFunction(data.value.items); }
// A simple utility function to display the title of the feed items
function displayOutput(txt){
function myCallbackFunction(items){
// 'items' contains the separate feed items;
// 'title' contains the item title, 'link' the url, 'description' the main text
// Run through each item in the feed and print out its title
for (var i=0; i < items.length; i++){
// You could easily call 'myArbitraryCallbackFunction(items)" from this function
// Tell JQuery to call the feed loader when the page is all loaded
<div id="test"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.