I'm trying to execute three similar ajax calls in order whilst returning a Boolean for each.
Example Below
function Request(){
var _req1_successful = false;
var _req2_successful = false;
var _req3_successful = false;
_req1_successful = RequestCall(**params**)
_req2_successful = RequestCall(**params**)
_req3_successful = RequestCall(**params**)
**Carry out results etc...**
}
function RequestCall(**Params**) {
$.ajax({"URL",
contentType: "application/json; charset=utf-8",
type: "POST",
data: "{**Params**}",
success: function(data) {
return true
},
error: function(x, e) {
return false;
}
});
}
I've looked at callback's but either i'm missing something or you cant return values using them. (Forgive if incorrect im fairly new to JS)
I read adding a Aysnc="False"
property to the ajax call would work but didn't seem to...
So in a nutshell im trying to execute each call sequentially then once all has been carried out execute the logic afterwards.
Any ideas or pointers?