Getting last message from Tumblr via jquery

I am trying to integrate a Tumblr blog into a website. In particular, I want to display the last text message.

I looked at the Tumblr API and everything looks pretty simple, but I can't get it to work.

According to the documentation for the Tumblr API v2 ( http://www.tumblr.com/docs/en/api/v2 ) this is the call I need:

http://api.tumblr.com/v2/blog/blog.tumblr.com/posts/text?api_key=KEY&limit=1 and if I put it in my browser, I will get what I want.

However, if I try to get post'title for it using jquery 1.7.1 as below

$.getJSON('http://api.tumblr.com/v2/blog/blog.tumblr.com/posts/text?api_key=<KEY>&limit=1', function(data) {
  console.log("data.posts[0].title");
});

I get a blank answer.

Did I miss something?

Thank you for your help.

Sig

+3
source share
2
+2

, , . $.ajax JSONP. tumblr.

$.ajax({
    type: "GET",
    url: "http://api.tumblr.com/v2/blog/blog.tumblr.com/posts/text?api_key=<KEY>&limit=1",               
    dataType: "JSONP",
    success: SuccessCallbackFunction,
    error: ErrorCallbackFunction,
});
+1

All Articles