Skip to content

Instantly share code, notes, and snippets.

@codingjester
Last active August 6, 2020 15:28
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save codingjester/5073097 to your computer and use it in GitHub Desktop.
Save codingjester/5073097 to your computer and use it in GitHub Desktop.
User JQuery with the Tumblr API & JSONP
$.ajax(
'http://api.tumblr.com/v2/blog/codingjester.tumblr.com/posts?api_key=<your_key>',
{
dataType: 'jsonp',
success: function (d) {
console.log(d); // On success log the data to the console
},
}
);
// More explicit information
$.ajax('https://api.tumblr.com/v2/blog/codingjester.tumblr.com/posts',
{
dataType:'jsonp',
data: {
limit : 1,
api_key : 'your_key'
},
success: function(d) {
console.log(d);
}
}
);
@JeanneRaffut
Copy link

Thank you! This is my adaption: Why is this not working? I want to randomly call one tag (or even better a tagged photo on tumblr) and give an offset:

$.ajax(
api_key: "",
{
dataType: 'jsonp',
success: function (data) {
console.log(data); // On success log the data to the console
},
limit: 1,
offset: Math.round(Math.random() * moods[mood].total)
}
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment