title: Pause loop for a second after every five iterations
body: <p>For my program I have to make a 100 JSON requests. Unfortunately only 5 calls per second are allowed. Since I am making all the JSON request with a for loop (is the best way), I have to pause the loop after every 5 calls for 1 second. </p>
  
  <pre><code>function Hello() {
     $("#randomdiv").show();
     for (var i=0; i&lt;100; i++) {
         if (i%5 == 0 &amp;&amp; i&gt;0) {
           sleep(1000);
         }   
         $.getJSON(JSONreq, function(data) {Just a JSON request, nothing special}) 
      };  
  };
  </code></pre>
  
  <p>The <code>sleep(1000)</code> causes the whole page to freeze for a about 20 seconds and prevents the <code>#randomdiv</code> from appearing before the JSON requests are made.</p>
  
  <p>What can I do to solve this problem? 
  Thanks a lot :)</p>