// Mysql info to show a list of ...">

How to update results on my site using AJAX?

How to update results on my site using AJAX?

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

I want to update the div every 10 minutes.

+3
source share
2 answers

Put your AJAX code inside setIntervaljavascript function

setInterval("getListItems()", 600000);
+5
source

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

Example

(I have not tested):

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
source

Source: https://habr.com/ru/post/1796192/


All Articles