In this code below, it updates a div every 20 seconds. Only when I enter the page I have to wait 20 seconds for it to appear. I wish he had already appeared at the beginning of the page.
<div id="latestData"><img src="img/loading3.gif" /></div>
<script src="http://code.jquery.com/jquery-latest.js"></script><script>$(document).ready(function(){setInterval(function(){$.get("includes/principal/contador_mapa.php", function (result) {
//nome da pagina com o select mysql
$('#latestData').html(result); // nome da DIV
});
}, 20000); // segundos
});
</script>