Calling Ajax repeatedly after specific time using jquery -


searched on jquery timer functions need solution call below ajax function every 5 minutes using jquery..

    $.ajax({   type: 'post',   url: '<?php echo base_url().'index.php/score-refresh/scorecard';?>',   success: function(html){     $('.score_news').append(html);   } }); 

you can using setinterval call this

var timer, delay = 300000; //5 minutes counted in milliseconds.  timer = setinterval(function(){     $.ajax({       type: 'post',       url: '<?php echo base_url().'index.php/score-refresh/scorecard';?>',       success: function(html){         $('.score_news').append(html);       }     }); }, delay); 

if need stop @ point call

clearinterval(timer); 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -