Run a JavaScript function continuously repeating with a time interval

ajax, javascript, jquery

Solution

This will repeat the task until you clear the interval (with clearTimeout(repater))

var repeater;

function doWork() {
 $('#more').load('exp1.php');
 repeater = setTimeout(doWork, 1000);
}

doWork();

Per OP's original condition:

I want code that repeat function continuously...

Problem

This is my first question, and I would appreciate you answering soon. I would like code to repeat a function continuously... I have tried some code but it hasn't worked. I tried this code: ``` <script type="text/javascript"> $(function() { $('#more').load('exp1.php'); // SERIOUSLY! }); </script> ``` I want to repeat this function after some interval. I have tried `setInterval()` and `setTimeout()` But, I haven't received results.

Original source