RSS feed using JavaScript – Cont’d

JsonDuit turned out to be a failed experiment, mainly because they insist on linking to the feed “widget” created on their website.
What I was looking for was a way to make a cross domain request which would fetch the RSS XML and I could parse it. Turns out solution 3 from my earlier post was the way to go. To implement this is extremely simple. First include the yui file:

       http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js

Once this is done, its easy to use it anywhere in the project:

YUI().use('yql', function(Y) {
Y.YQL('select title from rss where url="https://vikasrao.wordpress.com/feed/"', function(r) {
  var items = r.query.results.item;
  dojo.forEach(items, function(data){
    //do something                        
  });
});

To experiment with YQL queries, use the YQL console here.

Advertisements

2 thoughts on “RSS feed using JavaScript – Cont’d

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s