jQuery anti cache paremeter
jQuery anti cache paremeter
shannonwrege
Posts: 22Questions: 9Answers: 0
I have seen it written that to disable the jQuery anti cache parameter, you should set ajax.cache = true. Is this a configuration parameter for the table or something global? Can someone give a code example?
This discussion has been closed.
Answers
FYI, I tried setting:
$.ajaxSetup({ cache: true });
on the document load but I still get the "_" parameter in the query string of the ajax loads for the datatable.
The exact opposite . Set it to
false
to disable - e.g.:Allan
Well, I actually want to disable the anti cache parameter (i.e. enable browser caching), but this code snipped is what I needed. Thanks!
Yeah the double negative is a bit odd, but
cache: false
is how you do it in jQuery.Allan
Followup to this earlier question. I have the ajax caching working, but only if I initially load the table that way. In other words:
and then calling
works fine. A cached version of test2.json is loaded. It seems that the initial setting instructed future ajax calls to use the cache.
I can not figure out how to do the initial load from data supplied on the page request and then do a cached ajax call. So if for example I initialize the table this way:
Then executing ...
... adds the cache busting querystring parameter. Is there a way to make the ajax load call with instructions to use the cached version if available?