Friday, December 18, 2009

Prevent Caching in Ajax

Hi,

6 months back, i was developing an application and i was facing an issue that even though i recreated new requests, the application fetched old data for me. However, later on i found that my application was using old data passed on as a URL parameter.

I resolved this in a simple manner.

My old URL was

                  url = "/getData.do"+ "?couCode=" + couCode;

I changed it to
                
                  url = "/getData.do"+ "?couCode=" + couCode+ "&ms=" + new Date().getTime();      

Thats what i did and the problem got vanished.....

Cheers!!!

Ujjjwal Soni

No comments: