forked from jfhovinne/jFeed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
65 lines (52 loc) · 1.66 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!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>