for (var i = 0; i < 5; i++) {
        (function(index) {
           ajaxFuncHere(i);
            //now you can also loop an ajax call here without problems: $.ajax({});
        })(i);
    }
I would like to delay each iteration with say 300 ms or something, how can I do that?
I tried putting a setTimeout like this:
for (var i = 0; i < 5; i++) {
        (function(index) {
          setTimeout(function () {
           ajaxFuncHere(i);
          }, 300);          
            //now you can also loop an ajax call here without problems: $.ajax({});
        })(i);
    }
However its not giving me the desired result, but instead just delaying and then put them all out.
How can I delay each iteration with 300 ms after the function itself is completed, (the reason I use the closure within)
 
     
     
     
    