1

Is it possible to access the Tumblr API from javascript in a normal HTML page? The same origin policy seems to be in the way. Assuming I just want to access some url like this (the key is the one from the api docs), is it possible to download and parse that json string with JSON.parse or something like that? I can't find anything helpful on google or here.

1 Answer 1

1

Use jsonp support provided by Tumblr to overcome same origin policy

$.getJSON('http://api.tumblr.com/v2/blog/david.tumblr.com/posts/photo?api_key=<api-key>&notes_info=true&callback=?', function(data){
    console.log(data)
})

Or

$.getJSON('http://api.tumblr.com/v2/blog/david.tumblr.com/posts/photo?callback=?',{
    api_key: '<api-key>',
    notes_info: true
}, function(data){
    console.log('result', data)
})

Demo: Fiddle

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.