I have a question regarding using getJson.
I had a getJson call and I couldn't figure out why it didn't do what is was supposed to do. I then put an alert after the getJson and found out that the alert was getting executed before the getJson.
I then figured the only way to solve this would be to use $.ajax with async false as follows
$.ajax({
url: url,
dataType: 'json',
async: false,
success: function (data) {
if (data == true) {
alert("Cannot continue.")
returnval = false;
}
}
});
Just wondering if there is any other way to solve this issue to where I need the json through ajax call to execute first without using async false. Note that I am using MVC C# the the above code is in my view.