Here is a possible solution for you.
a) You need some kind of proxy to allow loading content with ajax from different sources. It is advisable to whitelist and add CORS Headers etc. to prevent exploiting your proxy. Create for example a php-file on one of your servers with this functionality:
$valid_url_regex = '/.*(rss|feed|atom).*/';
$url = $_GET['url'];
if ( !preg_match( $valid_url_regex, $url ) ) exit;
$feeds = file_get_contents($url);
//this is some workaround to get special namespaces into the json
$feeds = str_replace("<content:encoded>","<contentEncoded>",$feeds);
$feeds = str_replace("</content:encoded>","</contentEncoded>",$feeds);
$feeds = str_replace("<media:content ","<mediaContent ",$feeds);
$feeds = str_replace("</media:content>","</mediaContent>",$feeds);
$simpleXml = simplexml_load_string($feeds, "SimpleXMLElement", LIBXML_NOCDATA);//this is for CDATA
$json = json_encode($simpleXml);
header("Access-Control-Allow-Origin: http://yourdomainnamehere");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400');
print $json;
b) Perform an async ajax-call to the proxy-script and handle the data:
function loadRss(url)
{
$.ajax({
url: 'yourserverurl/rssproxy.php?url='+url,
type: 'GET',
success: function(response) {
handleResponse(JSON.parse(response));
}
});
}
function handleResponse(response) {
var entries;
if(response.entry) //ATOM
entries = response.entry;
else if(response.channel.item) //RSS 1/2
entries = response.channel.item;
var feedTitle="";
if(response.title)
feedTitle = response.title;
else if(response.channel.title)
feedTitle = response.channel.title;
//iterate all news entries
$.each(entries, function (i, e) {
console.log("Entry #"+i);
console.log(e);
//access the data as necessary like e.content, e.summary, e.contentEncoded etc....
}
);
}
I changed my google rss api a few years ago to YQL, now i had to do it again today, took a few hours, but this time you wont be dependent on some 3rd-party vendor and hopefully you can use your new reader code until rss vanishes in preference of mankind for the famous filter bubble ;)
Above code is just a hint and of course you will have to invest some time if you want to map the response to the generalized YQL Structure. I didnt go that way and accessed the properties of the response as necessary.