There is a different behaviour between Internet Explorer and Google Chrome for when using async callbacks. For this function I load data from the server with a for-loop for the year 2017 until the current year.
The code I have is:
for (var y = 2017; y <= crrntYr; y++) {
cnt++;
var rtrn = evalExpression(sssn, "call('rp/ajax/wkChrt','" + y + "')", function (data) {
console.log(y);
});
}
The problem exists in Internet Explorer, when the callback is done: y == 2019 So for every year when the data is retrieved, the for loop is already ended and y=2019.
In Google Chrome it works as intented, when the callback is done, y is the value of when the evalExpression() was started, so it is the year is is processing.
How can I set y to the right value in the callback function?
Edit 10:42: Simplified the function to the basics