Created
September 2, 2010 13:56
-
-
Save till/562311 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
/* <![CDATA[ */ | |
jQuery(document).ready(function(){ | |
jQuery.noConflict(); | |
var jq = jQuery; | |
jq.ajax({ | |
url: '/rss', | |
type: 'GET', | |
dataType: 'xml', | |
error: function (xhr, status, e) { | |
}, | |
success: function(feed){ | |
var html = ''; | |
var item = null; | |
var items = ; | |
var title, text, link = null; | |
jq(feed).find('item').each(function(i){ | |
item = $(this); | |
title = jq(item).find('title').text(); | |
text = jq(item).find('description').text(); | |
link = jq(item).find('guid').text(); | |
html += '<li><em>' + title + '</em><br />'; | |
html += text; | |
if (html.substr(-1, 1) != ' ') { | |
html += ' '; | |
} | |
html += '<a href="' + link + '" class="newsmore">Read more</a>'; | |
html += '</li>'; | |
if (i == 2) { | |
break | |
} | |
}); | |
jq('#blogposts').append(html); | |
} | |
}); | |
}); | |
/* ]]> */ | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment