Thursday, September 10, 2015

Fetching external RSS feeds with jQuery and Google Feed API

Sometimes, you just want to fetch the rss feeds from an external site without touching any server code. jQuery and Google Feed API will save your day.

rss_parser.js:



Then, in your html page or post, use this:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
<script src="/path/to/parser.js"></script>
<div id="myrss" class="box"></div>
<script type="text/javascript">
      $(function(){
            parseRSS('http://mywebsite.com/feed/', '#myrss');
      });
</script>

The feeds will be inserted into myrss div.

Reference: https://developers.google.com/feed/v1/reference