How do I refresh results on my site with AJAX?
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);
});
精彩评论