2
need to call another ajax request within a condition. But the outside ajax does not wait for the inside to finish. Example: I wear this
$.ajax({
type: "GET",
url: "MINHA_URL",
success: function (e) {
if(e == 'erro'){
$.ajax({
type: "GET",
url: "MINHA_SEGUNDA_URL",
success: function (f) {
IMPRIMIE ALGUMA COISA
}
.....
The problem is that it does not run correctly. How to proceed?
I don’t know which version of jQuery you are using but the common is to use the
done
to execute something when the request is actually completed.– Renan Gomes