I have a comment script similar to facebook, I adde开发者_开发技巧d in a jquery timer to refresh the contents on div id, it does what it is suppose to do, but the problem is it kills the values of the other script I use in the same file on refresh, is their some way of fixing this or is it a dead duck so to speak. many thanks if I can get this to work with some help.
<script>
$(document).ready(function() {
$("#responsecontainer").load("index.php");
var refreshId = setInterval(function() {
$("#responsecontainer").load('index.php?randval='+ Math.random());
}, 60000);
$.ajaxSetup({ cache: false });
});
</script>
<div id="responsecontainer">
Check out my answer to the following question. I would suggest using IIFE over setInterval(). I also think its a bit cleaner.
Refresh a table with jQuery/Ajax every 5 seconds
精彩评论