"..Use setInterval() when you want to send AJAX request at particular interval every time and doesn’t want to depend on the previous request is completed or not.
But if you want to execute the AJAX when the previous one is completed then use the setTimeout() function."