How to Call a Function Every X Seconds in jQuery
A lot of times when a page is loaded, you will want to wait to do anything until the user interacts with an element, like submitting a form. Other times, you will want an event to happen every X seconds. To do this, you would use:
// Put your code here
It is important to note that the interval is set to 5000. It is calculated in milliseconds, so 5000 would actually be 5 seconds.