I must make Ajax calls with dynamic parameters, I use the $ .each to go through the values of the parameters and send them to the ajax call but apparently they run at the same time, and I want it to run one after another, as it is dynamic I do not have an exact number of calls to Ajax, any ideas ?? This is what I tried:
$.each(params, function (index, value) {
v1 = value.v1;
v2 = value.v2;
llamadoAjax(v1, v2);
});
Where calledAjax is:
var parametros = {
v1: v1,
v2: v2
}
$.ajax({
url: "WebService/ws.aspx/Funcion",
type: 'POST',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(parametros),
destroy: true,
success: function (result) {}
});
It works very well but ... apparently the call to ajax is made at the same time, some idea of how to pause them ??