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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值