Solved

setInterval not working in Firefox

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with mod_substitute 18 78
jQuery menu problem in an older browser 6 33
Submitting form with no refresh at the end 2 32
How does this modal work? 3 34
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
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 how to dynamically set the form action using jQuery.
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)

751 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