dimanche 17 juillet 2016

JQuery ensure that get requests stay in chronological order

I need to send several get requests, and i need to make sure that jquery will wait for the request to finnish before moving on to the next requests...

if i simply go

$.get("url 1 here", { parameter:"value"}...
$.get("url 2 here", { parameter:"value"}...
$.get("url 3 here", { parameter:"value"}...

Will jquery wait for the first request to finnish before it sends the next, or should i do something like:

$.get("url 1 here", { parameter:"value"}, function(data){
$.get("url 2 here", { parameter:"value"}, function(data){
$.get("url 3 here", { parameter:"value"});
});
});

to ensure that they always finnish before the next is sent? thanks.

Aucun commentaire:

Enregistrer un commentaire