I have the following code that has a list, and for every element in this list, do an ajax call.
util.testMethod = function(list) {
var map = new Map();
list.forEach(function(data) {
$.ajax({
url: 'https://......',
type: 'GET',
data: // data needed here
success: function(data) {
// do something
},
error: function(jqxhr, settings, exception) {
// dos omething
}
});
});
return map;
};
Since I am making a number async ajax calls, let's assume there is 1 of them takes so long to execute. Is there a possibility that this testMethod will return before that ajax call finish?