Good day
I have a call to the same function 9 times. Unfortunately it looks like it runs so fast that a couple of function dont finish or get called
loadpaymentboxes('1t1', '1h1', p1t1, p1i1);
loadpaymentboxes('1t2', '1h2', p1t2, p1i2);
loadpaymentboxes('1t3', '1h3', p1t3, p1i3);
loadpaymentboxes('2t1', '2h1', p2t1, p2i1);
loadpaymentboxes('2t2', '2h2', p2t2, p2i2);
loadpaymentboxes('2t3', '2h3', p2t3, p2i3);
loadpaymentboxes('3t1', '3h1', p3t1, p3i1);
loadpaymentboxes('3t2', '3h2', p3t2, p3i2);
loadpaymentboxes('3t3', '3h3', p3t3, p3i3);
How do you chain these calls so that only after the the previous call has finished, it is allowed to run it again.
This code will execute the functions after one second
var i = 1;
var timer = setInterval(function() {
if( i >= 9 ) {
clearInterval( timer );
}
//YourFunction();
console.log(i);
i++;
}, 1000/*Change this time in milliseconds to modify the execution time between functions*/);