jQuery cache

Yesterday I spent a lot of time on catch this problem. In my app, I need to make a GET Ajax request call to server side. After it's getting the time to DEV, I found the same URL will not be responded. It won't go to the resourceMapping method in the controller.

Afterwards, I use "Live HTTP headers" which is a Firefox plugin to catch request call. Because before the GET Ajax I still make a POST call, so I can see it makes a request without appending Liferay parameters. It's still not clear now. After that, I remove the POST call, directly make a GET call. The real problem shows up now. When I make the same GET request call again not the first time, it won't make a request call instead of directly display the cache.

From the jquery API doc.

GET will always be cached except you explicitly declare cache:false. What cache:false does is append a timestamp at the end of the URL. It was very strange yesterday because even though I set cache:false, it still gets data from the cache. Then, I appended a random number at the end of URL. Finally, it works.

POST will always won't cached.

你可能感兴趣的:(jQuery cache)