title: how to make ajax calls continuously for 5 seconds once
body: <p>How to make ajax calls continuously for 5 seconds once.</p>
  
  <p>I have used <code>setTimeout</code> like below,</p>
  
  <pre><code>setTimeout(function()
  {
      someFn();
  }, 200);
  </code></pre>
  
  <p>But it use more db connection. Can anyone tell me an effective way to call a function continuously for 5 seconds once.</p>
  
  <p>Function that i use inside setTimeout or setInterval will be used to update values to database.hence this will increase db connections. and result in lost db connection error.so i need something that will not increase db connections</p>
  
  <p>i am using below code</p>
  
  <pre><code>push_notification('&lt;?php echo $user_details1[0]['id']; ?&gt;');
  
  setInterval(function() 
  {
      push_notification('&lt;?php echo $user_details1[0]['id']; ?&gt;');
  
  }, 10000);
  
  
  function push_notification(driver_id)
  {
  
      var dataS = "&amp;type=1&amp;driver_id="+driver_id;
      var SrcPath = "&lt;?php echo URL_BASE; ?&gt;";
      var response;
  
      $.ajax
      ({          
          type: "POST",
          url: SrcPath+"driver/adminpushnotification/1", 
          data: dataS, 
          cache: false, 
          dataType: 'html',
          success: function(response) 
          {   
              //some Functionality
          }
      });
  }
  </code></pre>