jQuery:解析RSS提要
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jQuery:解析RSS提要相关的知识,希望对你有一定的参考价值。
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/)
<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 $(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">
以上是关于jQuery:解析RSS提要的主要内容,如果未能解决你的问题,请参考以下文章