JSONP and asynchronous - capturing and returning response.
Hello, I'm having a nightmare. I've spent all day on this, and would like some help. I'm so near yet so far.
If this is synchronous, normal json request, I can capture the result (data) and return it to a calling function.
However jsonp is not synchronous. Whilst the data IS returned, and I can view it from within the success function, but I cannot access it after that.
- $.ajax({
url: remote_url,
async: false,
cache: false,
dataType: "jsonp",
jsonp: 'jsonp_callback',
type: "GET",
data: vars,
success: function(data) {
console.log($.dump(data));
result = data;
}
});
I am building a library of functions which call this function, so I cannot have the data processing done within the success function, I need to extract the data itself.
I would be grateful for some assistance.