/ Published in: jQuery
Here's a simple example of how to parse RSS feeds using jQuery. You will need jFeed (http://www.hovinne.com/blog/index.php/2007/07/15/132-jfeed-jquery-rss-atom-feed-parser-plugin) and a bit of help from PHP (http://snipplr.com/view/12467/php-capture-rss-feed/)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript" src="./js/jquery/jquery.js"></script> <script type="text/javascript" src="./js/jFeed/build/dist/jquery.jfeed.pack.js"></script> <script type="text/javascript"> function loadFeed(){ $.getFeed({ url: 'proxy.php?url=http://locationofrssfeed/', success: function(feed) { //Title $('#result').append('<h2><a href="' + feed.link + '">' + feed.title + '</a>' + '</h2>'); //Unordered List var html = '<ul>'; $(feed.items).each(function(){ var $item = $(this); //trace( $item.attr("link") ); html += '<li>' + '<h3><a href ="' + $item.attr("link") + '" target="_new">' + $item.attr("title") + '</a></h3> ' + '<p>' + $item.attr("description") + '</p>' + // '<p>' + $item.attr("c:date") + '</p>' + '</li>'; }); html += '</ul>'; $('#result').append(html); } }); } <script type="text/javascript">