I'm building an angular application, there are many ajax calls. I need to wait for each call response to get data from it, that why I make the synchronous.
$.ajax({
type: "POST",
url: servicePath,
cache: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
data: "{}",
success: success,
error: error
});
But this is a problem because if I call "showPleaseWait()"(this is a loading popup) it is not showing, because DOM is not updating unless ajax call is not complete. It's showing if I'll make my call async, but I can't get my data that time.
Please, can you help me to solve this problem?
showPleaseWait()before$.ajax, and callhidePleaseWait()in thesuccessorerrorcallback. Async is the power of Ajax, why not?