Is it possible to set async: false
when calling $.getJSON()
so that the call blocks rather than being asynchronous?
You need to make the call using $.ajax()
to it synchronously, like this:
$.ajax({
url: myUrl,
dataType: 'json',
async: false,
data: myData,
success: function(data) {
//stuff
//...
}
});
This would match currently using $.getJSON()
like this:
$.getJSON(myUrl, myData, function(data) {
//stuff
//...
});