I'm trying to create a page that stays up-to-date without having to refresh.
I created a Javascript function that looks for select
and while
of another page, but this is generating high CPU consumption and the server faces have already complained. How do I always give select
in Javascript without having this problem?
<!---- função que chama a pagina onde tem o while ----->
<script type="application/javascript">
function busca (){
var numero1 = $("#n1").val();
var numero2 = $("#n2").val();
$.post("busca_p.php", {n1:numero1, n2:numero2}, function(retorno){
$(".msg_porto").html(retorno);
});
};
</script>
<script>
window.setInterval(busca,1000);// coloquei este para ativar a funlção a cada 1 segundo
</script>
Calls the page busca_p.php
that has a select
and while
and loads within div (msg_porto)
.
It works fine, but gets processed all the time and has complained about high CPU usage by the server.