setTimeout

Simple Polling Solution …

We often find a need to repeatedly perform an action while some condition is met. A common example is the need to poll or call a URL repeatedly at a fairly regular interval while some condition exists. This might mean making an AJAX request to a third party service every 5 seconds until it responds …