Calling a function every 60 seconds

后端 未结 13 2252
情书的邮戳
情书的邮戳 2020-11-22 08:24

Using setTimeout() it is possible to launch a function at a specified time:

setTimeout(function, 60000);

But what if I would l

13条回答
  •  一整个雨季
    2020-11-22 09:18

    In jQuery you can do like this.

    function random_no(){
         var ran=Math.random();
         jQuery('#random_no_container').html(ran);
    }
               
    window.setInterval(function(){
           /// call your function here
          random_no();
    }, 6000);  // Change Interval here to test. For eg: 5000 for 5 sec
    
    
    
    Hello. Here you can see random numbers after every 6 sec

提交回复
热议问题