开发者

How do I refresh results on my site with AJAX?

开发者 https://www.devze.com 2023-02-14 13:48 出处:网络
How do I refresh results on my site with AJAX? <div id=\"Results\"> // Mysql info to show a list of <li>

How do I refresh results on my site with AJAX?

<div id="Results">
    // Mysql info to show a list of <li>
</div>

I want to refresh the div every 10 mi开发者_StackOverflownutes.


Put your AJAX code inside the setInterval javascript function

setInterval("getListItems()", 600000);


I would use jQuery's load() element with a recursive function.

example (I didn't test):

function reload(url,miliseconds) {        
    setTimeout(function() {
        $('#container').text('');
        $('#containter').load(url);
         return reload(url,miliseconds);
    },miliseconds);
}
$(document).ready(function(){
    reload('http://www.website.com/dynamic_content.php',600000);
});
0

精彩评论

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