Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

setInterval not working in Firefox

Posted on 2009-04-01
5
Medium Priority
?
1,509 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 1200 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 800 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

719 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