3
How to wait for the return of an ajax to continue the requisicao of another? I got the following:
$.ajax({
type: "GET",
url: 'http://uma_url_qualquer.com',
success: function (e) {
var item = f.items;
//AQUI A OUTRA CHAMADA
$.ajax({
type: "GET",
url: 'http://uma_url_qualquer.com',
success: function (f) {
}
});
//AQUI TERMINA
}
});
The way these two run at the same time and error. I tried to use async
but it is already obsolete and crashes my browser! How to solve?
As you have it in the code is a valid option. What does not work in this template?
– Sergio
I use a value taken in the first to use in the second. But the way the first executes all and only then the second executes.
– Thiago
It is correct that one only executes after the other and it is possible to use data from the first in the second, but not the other way around. One thing I don’t understand is why
var item = f.items;
before the second call whenf
is an argument of the second and not of the first.– Sergio