If anyone could explain to me, what is the common practise for handling the data fetched from ajax call?
Having a callback function allows to use the fetched data WITHIN the callback function.
Therefore I assume that the only way to 'play' with the data is to wrap a big chunk of the code that has got any functions relying on the data, inside the callback function?
Thank you. // Side note - I read How do I return the response from an asynchronous call? already.
My question is about the common practise.
var my_data;
$.ajax({
method: "GET",
url: "exampleurl",
success: callback
});
function callback(response) {
this.response = response;
var my_data = response;
// Does here go all the functions that will ever use my_data?
};