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
//...
});