jQuery.get()
is a shorthand for jQuery.ajax()
with a get call. But when I set cache:false
in the data of the .get()
call, what is sent to the server is a parameter called cache with a value of false. While my intention is to send a timestamp with the data to the server to prevent caching which is what happens if I use cache: false
in jQuery.ajax data. How do I accomplish this without rewriting my jQuery.get calls to jQuery.ajax calls or using
$.ajaxSetup({
// Disable caching of AJAX responses
cache: false
});
update: Thanks everyone for the answers. You are all correct. However, I was hoping that there was a way to let the get call know that you do not want to cache, or send that value to the underlying .ajax() so it would know what to do with it.
I a. looking for a fourth way other than the three ways that have been identified so far:
通过ajaxSetup在全局实现
Using a .ajax call instead of a .get call
通过将保存时间戳的新参数添加到.get调用来手动执行此操作.
我只是认为应该将此功能内置到.get调用中.