By using a for-loop to ask the server for several database entries I wrote a piece of code, which works proper good, BUT:
Magically this piece of code doesn´t work on the IE11. For Google Chrome, Firefox, Safari, ..., it works porper good. But unfortunately I need to use IE11. The code doesn´t give an error, but the data returned from the server are not there. Just the last element in the for - loop got transmitted.
By using the IE Network connection representation tool, it can be seen that all requests got sent back, but somehow just the last one is already there. Mabye someone had already this problem and can give me some hints...
function getData(setAddress_Event, liter_hour, Fluid_id, dateArray){
return $.getJSON(setAddress_Event + liter_hour + Fluid_id + "/" + dateArray).then(function(data){
return {
data_list:data
};
});
}
//get day2day data
var numPendingResults = dateArray.length;
//new var declaration --> "let" is only valid inside the for loop!!
for(let j = 0; j<dateArray.length; j++)
{
getData(setAddress_Event(), "liter_hour/", Fluid_id, dateArray[j]).then(function(returndata){
//received data!
data_collection[j] = returndata;
numPendingResults--; // one less to wait for!
if (!numPendingResults) { // we have everything!
//console.log(data_collection);
//function call which sends the data forward
dataReady(data_collection, data_limit);
}
the function dataReady, should process the received data, but somehow using IE11, just the last request from the loop is there! Therefor I decided to open a new QUESTION. Maybe there is one genius who can give me some hints...