How to refresh

后端 未结 4 814
不知归路
不知归路 2021-01-06 06:11

How to refresh the auto refresh div inside the div theres is php

The following code dont work?

var refresh = setInterval(function() {  $(\"#recent_ac         


        
4条回答
  •  囚心锁ツ
    2021-01-06 06:42

    there is nothing about the div 'recent_activity' that perpetually synchronizes with your server. However, supposing you had some dynamic webpage recent_activity.php which returns current data from your recent-activity database, you could load that into the div every once in a while with

    var refresh = setInterval(function() { 
        $('#recent_activity').load('recent_activity.php');
    }, 1);
    

    P.S. 1 millisecond spamming is usually a bad idea. Look into the comet pattern if you want sub-second responses to activity.

提交回复
热议问题