0

I have a comment script similar to facebook, I added 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">
ianace
  • 1,646
  • 2
  • 17
  • 31
Craig
  • 1

1 Answers1

0

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

Community
  • 1
  • 1
  • Ok stupid me, while I was cross checking browsers, it seems it works fine in IE, but not in Firefox, Chrome or Opera, so any suggestions as to how I can get it working in them browsers is appreciated. – Craig Apr 27 '11 at 06:23