Solved

setInterval not working in Firefox

Posted on 2009-04-01
5
1,499 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
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.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

820 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