jQuery RSS/ATOM feed parser plugin
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

65 lines
1.7 KiB

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jFeed - jQuery feed parser plugin - example</title>
<style type="text/css">
h3 { margin-bottom: 5px; }
div.updated { color: #999; margin-bottom: 5px; font-size: 0.8em; }
</style>
<script type="text/javascript" src="jquery/jquery.js"></script>
<script type="text/javascript" src="build/dist/jquery.jfeed.pack.js"></script>
<script type="text/javascript">
jQuery(function() {
jQuery.getFeed({
url: 'xml/rss-20.xml',
success: function(feed) {
jQuery('#result').append('<h2>'
+ '<a href="'
+ feed.link
+ '">'
+ feed.title
+ '</a>'
+ '</h2>');
var html = '';
for(var i = 0; i < feed.items.length && i < 5; i++) {
var item = feed.items[i];
html += '<h3>'
+ '<a href="'
+ item.link
+ '">'
+ item.title
+ '</a>'
+ '</h3>';
html += '<div class="updated">'
+ item.updated
+ '</div>';
html += '<div>'
+ item.description
+ '</div>';
}
jQuery('#result').append(html);
}
});
});
</script>
</head>
<body>
<h1>jFeed - jQuery feed parser plugin - example</h1>
<div id="result" />
</body>
</html>