I cannot assign the data parameter of the jQuery.getJSON function to variable.
var storage;
$.getJSON('server.json', function(data) {
storage = data;
});
console.log(storage);
EDIT : ok I understand, so let's say the 'storage' variable is equals the server.json file, but i can't use it because the lines of code below the $.getJSON executed before the server answered, so how can i check whenever the server is answered?
$.getJSONhave the additional complexity of using a callback if it ran synchronously...?