I have a pretty basic scenario: Run 3 Google maps place URLs and show results on every success
This is what I have so far:
var values = ["url1", "url2", "url3"];
values.forEach(function(value, i) {
var jsonReq = JSON.stringify({
action: 101,
supported: value
});
...
$.ajax({
type: "POST",
url: "data.ajax.php",
dataType:"json",
data:{
data:jsonReq
},
success:function(data){
// parse results
....
}
});
});
The problem is I run in loop all 3 URLs without waiting on success.
I want to send next request only when get response (callback) from previous one.
Any suggestions?
Thanks,
in complete function in ajax request call next request