Here is a fiddle I'm working on.
I'm trying to load the posts from ftsstudios.tumblr.com
with JSONP, and then using that data on a post reader.
get_data = function (data) {
FTSPosts.raw = data;
};
$.ajax({
url: "//api.tumblr.com/v2/blog/ftsstudios.tumblr.com/posts?api_key=myapikey&limit=20&jsonp=get_data",
dataType: "jsonp"
});
The above snippet should set FTSPosts.raw
to the response obtained.
The problem with this is that the data
retrieved by get_data
returns undefined
.
What is the problem?
There was a few errors in the code. But the answer to the question is:
get_data = function (data) {
FTSPosts.raw = data;
};
$.ajax({
url: "//api.tumblr.com/v2/blog/ftsstudios.tumblr.com/posts?api_key=myapikey&limit=20",
dataType: "jsonp",
jsonp: "jsonp"
}).success(get_data);
2 things:
jsonp: "the_parameter_callback"