title: Why aren't ajax calls being made with a specified delay
body: <p>I am trying to call an action on a controller with ajax: 10 times with a 2 second delay in my MVC5 application. </p>
  
  <p>Here is the code I've written:</p>
  
  <pre><code>$(document).ready(function () {
  
      (function loop(i) {
          setTimeout(function() {
              var d = new Date();
              console.log(d.getTime());
              callAjax();
                  console.log("works " + i);
                  if (--i) loop(i); 
              },
              2000); // ms
      })(10);
  
      function callAjax() {
          $.ajax({
              url: '/Home/StartElection',
              type: 'POST',
              data: "test",
              async: true
          })
              .done(function (partialViewResult) {
                  $("#partialTable").html(partialViewResult);
              });
      };
  });
  </code></pre>
  
  <blockquote>
    <p>The console log is as expected (with a 2 second delay) but the calls to the controller happen instantly - when I set a break in Visual Studio on the controller action the next call after continuing takes 2ms </p>
  </blockquote>
  
  <p>I can't see why this is happening - can any one help?</p>
  
  <p><strong>Edit:</strong> I added a console log of Date.getTime() just before the ajax call &amp; there are 2000 ms between each</p>