Skip to content

Instantly share code, notes, and snippets.

@alicial
Created August 5, 2012 17:03
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save alicial/3265951 to your computer and use it in GitHub Desktop.
Save alicial/3265951 to your computer and use it in GitHub Desktop.
How to Display Recent Posts in Tumblr
$(function() {
var url = '/rss';
var $list = $('#recent-posts');
$.ajax({
url: url,
type: 'GET',
dataType: 'xml',
success: function(data) {
var $items = $(data).find('item');
$items.each( function() {
var $item = $(this);
var link = $item.children('link').text();
var title = $item.children('title').text();
if (link && title) {
$list.append($('<li><a href="' + link + '">' + title + '</a></li>'));
}
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment