Hi
I have made a page thats makes an AJAX call to the server gets the time and displays it. In the OPEN method i have set

req.open("GET","/timerProg.cgi?param1="+new date(),false);

I have set the last parameter as false as i am expecting a synchronous request so that time displayed should be consistent.

I am using new date() since the browser is caching my request and displaying the same output everytime as i dont know any other alternative.

Please suggest the alternative so that browser does not cache the results and gives proper output each time.
Alternatives for auto refresh apart from the logic i have used are highly welcome

Hi
You can use random function of javascript to generate a random number and use that in query string.

Hi
Try passing a randomly gerated number as query string.

Like this
req.open("GET","/timerProg.cgi?rnd="+Math.random(),false);

Regards
Anish

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.