开发者

Ajax refresh of div not pulling in new forum posts

I'm using开发者_开发技巧 Simple:Press in Wordpress, and I have an Ajax auto-refresh code in the header, which refreshes ONLY the div that has the newest thread posts. The page refreshes just fine, but won't load in any new posts in that thread.

Here's the code in my header:

    <script>
    var refreshId = setInterval(function()
    {
        $('.sfposttable').fadeOut("fast").load('response.php').fadeIn("fast");
    }, 60000);
    </script>

Any ideas why the div refreshes, but doesn't pull in any new posts?


I think you have to use first

$(document).ready(function() {
    var refreshId = setInterval(function()
    {
        $('.sfposttable').fadeOut("fast").load('response.php').fadeIn("fast");
    }, 60000);

});

Here is a working example: http://jsfiddle.net/943UA/

Also you may want to change the refresh time: 60000 -> 1 minute make it 2000 -> 2 sec for test purpose.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜