Parse RSS with jQuery

Andy Brudtkuhl picture Andy Brudtkuhl · Oct 22, 2008 · Viewed 219.6k times · Source

I want to use jQuery to parse RSS feeds. Can this be done with the base jQuery library out of the box or will I need to use a plugin?

Answer

Andrew Childs picture Andrew Childs · Jun 7, 2011

WARNING

The Google Feed API is officially deprecated and doesn't work anymore!


No need for a whole plugin. This will return your RSS as a JSON object to a callback function:

function parseRSS(url, callback) {
  $.ajax({
    url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url),
    dataType: 'json',
    success: function(data) {
      callback(data.responseData.feed);
    }
  });
}