Solved

setInterval not working in Firefox

Posted on 2009-04-01
5
1,496 Views
Last Modified: 2012-05-06
Hi all,

Inside of $(document).ready(function () I have the code below.

This is working great in IE, it loads mypage.htm into mydiv every 9 seconds. If I change the contents of mypage.htm I can see it in mydiv after 9 seconds with IE, but not with Firefox. With Firefox I can see the reloading symbol on top of the tab every 9 seconds, but I don't see the page changed.

What am I doing wrong? Please help!!
Thanks a ton in advance!
var refreshit= setInterval(function()

{

     $('#mydiv').load("mypage.htm");
 

}, 9000);

Open in new window

0
Comment
Question by:Dada44
  • 2
  • 2
5 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 300 total points
ID: 24036999
erm... That is not setInterval that is not working
It is the jQuery or whatever it is you are using that does not do what you expect. Perhaps a caching issue

try


var refreshit= setInterval(function()
{
     $('#mydiv').load("mypage.htm?"+Math.random());
 
}, 9000);

or

var refreshit= setInterval('$("#mydiv").load("mypage.htm")', 9000);
 


0
 
LVL 6

Assisted Solution

by:twocandles
twocandles earned 200 total points
ID: 24037015
It seems a cache problem. Try to reload your page adding a random number:

$('#mydiv').load("mypage.htm?rnd=" + Math.random() );

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24037020
Great minds think alike - just some people type faster ;)
0
 
LVL 6

Expert Comment

by:twocandles
ID: 24037054
yes :)
0
 

Author Closing Comment

by:Dada44
ID: 31565218
50 points more for the faster one ;) Thanks guys!!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now