I'm developing applications using jQuery / Ajax and it has to refresh the page every 5 seconds, it works. But if I start using the application the browser starts to crash because of the code, how to fix this problem?
Follow the code:
<script>
$(document).ready(function() {
agenda();
});
function agenda() {
$.post('cadastrados_compromiso.php', {
mes2: "<?php echo $mes2; ?>",
mes: "<?php echo $mes; ?>",
ano: "<?php echo $ano; ?>",
dia: "<?php echo $dia; ?>",
semana: "<?php echo $semana; ?>",
agenda: "<?php echo $agenda; ?>",
login: "<?php echo $login; ?>"
}, function(resposta) {
$("#mudaragenda").html(resposta);
var myVar = setInterval(function(){agenda()},5000);
}, 'html');
}
</script>
It crashes all browsers, I think it starts to bugar because it is very little update time and the browser can not handle (?) ...