Friday, December 18, 2009

Prevent Caching in Ajax


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 = "/"+ "?couCode=" + couCode;

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

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


Ujjjwal Soni

No comments: