views:

27

answers:

1

Hello All,

I am using Apache Tomcat 6.0 as my development server. The problem that i am facing is that my application works very well on my development environment, but when i move it to staging the XHR is always picked up from cache except for the first time. I verified this using HTTP Watch and fiddler. Can someone Please help me in getting across this problem?

Appreciate the help in advance.

Regards

Vaibhav

+2  A: 

You can try one two things:

On the server side you can have following headers in the servlet that generatates the ajax response:

   response.setHeader( "Pragma", "no-cache" );
   response.setHeader( "Cache-Control", "no-cache" );

Or when you make an ajax request, append a query string to your url, passing the current time in millliseconds:

var req = "http://example.com/ajax?" + (new Date().getTime());
var client = new XMLHttpRequest();
client.open("GET", req);
client.send();
naikus