I want repeat this code every 4 seconds, how i can do it with javascript or jquery easly ? Thanks. :)
$.get(\"request2.php\", function(vystup){
if (vystup
Call a Javascript function every 2 second continuously for 20 second.
var intervalPromise; $scope.startTimer = function(fn, delay, timeoutTime) { intervalPromise = $interval(function() { fn(); var currentTime = new Date().getTime() - $scope.startTime; if (currentTime > timeoutTime){ $interval.cancel(intervalPromise); } }, delay); }; $scope.startTimer(hello, 2000, 10000); hello(){ console.log("hello"); }