I need to call another ajax request within a condition. But the outside ajax does not wait for the inside to finish. Example: I use 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 execute correctly. How to proceed?