title: How to call an Ajax function inside infinite while loop
body: <p>could anyone tell me how to run Ajax function inside infinite while loop?</p>
  
  <pre><code>while(true){
      $.ajax({
           type: 'POST',
           data: {'constraintId': experimentId},
           url: '/calender-generation-status/',
           success: function(data){
                console.log("inside ajax");
       }
    });
  }
  </code></pre>
  
  <p>The problem with this code is the while loop keeps running before success attr and all the statement after success attr has not been executed.</p>