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.
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>¬es_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