Search code examples
javascriptjqueryrssfeed

How to show rss feeds with image using javascript/jquery


How can i show Rss feeds with images using jquery? I tried some very popular plugins like:
1. gFeed
2. jfeed
3. zRssfeed

But nothing seems to support images. What is the best and easiest way to do this? Are there any plugins already available?


Solution

  • You should be able to fetch RSS using simple jQuery ajax call. Something like

    $.ajax({
          accept: 'application/rss+xml',
          url: 'http://rss.cnn.com/fortunebrainstormtech',
          success: function(){}
    });
    

    Using the URL above, I can see that images are return as HTML <img> (escaped ofcourse) tags. You just need to unescape them and embed them in your html.

    To unescampe simple using the javascript unescape function.

    Use Firefox addon called REST Client with the above URL. Add a request header Name=Accept, Value=application/rssxml to see the returned data yourself.