function loadFeed(id, cb) {
    var feedUrl = allFeeds[id].url,
        feedName = allFeeds[id].name;

    $.ajax({
        type: "POST",
        url: 'https://rsstojson.udacity.com/parseFeed',
        data: JSON.stringify({ url: feedUrl }),
        contentType: "application/json",
        success: function(result, status) {

            var container = $('.feed'),
                title = $('.header-title'),
                entries = result.feed.entries,
                entriesLen = entries.length,
                entryTemplate = Handlebars.compile($('.tpl-entry').html());

            title.html(feedName); // Set the header text
            container.empty(); // Empty out all previous entries

            /* Loop through the entries we just loaded via the Google
             * Feed Reader API. We'll then parse that entry against the
             * entryTemplate (created above using Handlebars) and append
             * the resulting HTML to the list of entries on the page.
             */
            entries.forEach(function(entry) {
                container.append(entryTemplate(entry));
            });

            if (cb) {
                cb();
            }
        },
        error: function(result, status, err) {
            //run only the callback without attempting to parse result due to error
            if (cb) {
                cb();
            }
        },
        dataType: "json"
    });
}
/* This function performs everything necessary to load a
 * feed using the Google Feed Reader API. It will then
 * perform all of the DOM operations required to display
 * feed entries on the page. Feeds are referenced by their
 * index position within the allFeeds array.
 * This function all supports a callback as the second parameter
 * which will be called after everything has run successfully.
 */
This function performs everything necessary to load a
feed using the Google Feed Reader API. It will then
perform all of the DOM operations required to display
feed entries on the page. Feeds are referenced by their
index position within the allFeeds array.
This function all supports a callback as the second parameter
which will be called after everything has run successfully.
This function performs everything necessary to load a feed using the Google Feed Reader API . It will then perform all of the DOM operations required to display feed entries on the page . Feeds are referenced by their index position within the allFeeds array . This function all supports a callback as the second parameter which will be called after everything has run successfully .
function loadFeed(id, cb) {
    var feedUrl = allFeeds[id].url,
        feedName = allFeeds[id].name;
    $.ajax({
        type: "POST",
        url: 'https://rsstojson.udacity.com/parseFeed',
        data: JSON.stringify({ url: feedUrl }),
        contentType: "application/json",
        success: function(result, status) {
            var container = $('.feed'),
                title = $('.header-title'),
                entries = result.feed.entries,
                entriesLen = entries.length,
                entryTemplate = Handlebars.compile($('.tpl-entry').html());
            title.html(feedName); 
            container.empty(); 
            entries.forEach(function(entry) {
                container.append(entryTemplate(entry));
            });
            if (cb) {
                cb();
            }
        },
        error: function(result, status, err) {
            if (cb) {
                cb();
            }
        },
        dataType: "json"
    });
}
function loadFeed ( id , cb ) { var feedUrl = allFeeds [ id ] . url , feedName = allFeeds [ id ] . name ; $ . ajax ( { type : "POST" , url : 'https://rsstojson.udacity.com/parseFeed' , data : JSON . stringify ( { url : feedUrl } ) , contentType : "application/json" , success : function ( result , status ) { var container = $ ( '.feed' ) , title = $ ( '.header-title' ) , entries = result . feed . entries , entriesLen = entries . length , entryTemplate = Handlebars . compile ( $ ( '.tpl-entry' ) . html ( ) ) ; title . html ( feedName ) ; container . empty ( ) ; entries . forEach ( function ( entry ) { container . append ( entryTemplate ( entry ) ) ; } ) ; if ( cb ) { cb ( ) ; } } , error : function ( result , status , err ) { if ( cb ) { cb ( ) ; } } , dataType : "json" } ) ; }
This function performs everything necessary to load a
 feed using the Google Feed Reader API.
This function performs everything necessary to load a feed using the Google Feed Reader API .
// Set the header text // Empty out all previous entries /* Loop through the entries we just loaded via the Google
             * Feed Reader API. We'll then parse that entry against the
             * entryTemplate (created above using Handlebars) and append
             * the resulting HTML to the list of entries on the page.
             */ //run only the callback without attempting to parse result due to error