Just do:
var totalPosts = null;
$.ajax({
url: "http://[BLOG NAME HERE].tumblr.com/api/read/json",
dataType: 'jsonp',
success: function(results){
totalPosts = results['posts-total'];
alert(totalPosts);
}
});
Needs jQuery but can be run before the document is loaded.