Is there a way to prevent ajax running async?
jQuery:
var returnValue = false;
var appCount = 0;
$.ajax({
type: "GET",
url: "getBookedAppointmentCountByDoctorAndDate.php",
data: dataString,
success: function (response){
appCount = response;
//alert(appCount);
if(appCount >= 6){
returnValue = true;
}
}
});
return returnValue;
I have an if statement in my code that checks the return value of this function. Because Ajax runs async, the if statement is continuing before the return value is set. Any ideas or suggestions of other methods to use to return php value?
if (blah($(this)) === true) {
alert("blah");
} else { ...