0

I want to alert variable after every 3 seconds if modulus is 0.

but the result is coming like this

5,10,15,20 delay for 3 seconds 5,10,15,20 delay.........and so on

Result i want

5 delay 3 seconds 10 delay 3 seconds 15 delay 3 seconds and so on

The Above issue is solved. Now the issue is that i want to execute a .bat file but it only works for ht first loop value

Here is the updated code

$(document).ready(function(){
var a = 3;
 var b = 0;
for (var i = 0; i < 9; i++) {
 (function (i) {
setTimeout(function () {
    if (i % a == 0) {
  var c = b + 5;
  b = c;
 <?php echo exec('abc.bat');  ?>
} else {

}
}, 3000*i);
})(i);
};

});
denny
  • 111
  • 2
  • 13

1 Answers1

0
var a = 5;
setInterval(function() {
  console.clear();
  console.log(a);
  a += 5;

}, 3000);

Your problem is that you put the console inside the loop, and you put the loop inside the interval which will execute all the numbers in every interval.

  • is their any way to use exec() function of php inside this as i tried it only work for the first value of loop – denny Jun 22 '18 at 07:49