I need a function to run every 2 minutes. I found this link a solution for my need:
The Code below, calls an alert after 5 seconds when the mouse is stopped.
Note
I put 5 seconds to save time on the test.
<script type="text/javascript">
$(function() {
timeout = setTimeout(function() {
alert('executa função');
}, 5000);
});
$(document).on('mouseover', function() {
if (timeout !== null) {
clearTimeout(timeout);
}
timeout = setTimeout(function() {
alert('executa função');
}, 5000);
});
</script>
What I need:
I need this script to work the same way only in an infinite loop, where every 5 seconds the alert will be called.
I tried to embrace the code with:
while(0 = 0){
}
But it did not work ...
How do I then run my function automatically every 5 seconds automatically?