By default Ajax calls in DataTables avoid caching by adding a bogus field onto the url, e.g. http://yoursite.com/api/?_348522852542'
. I would like to disable this. It appears that the ajax functions call fnServerData
which is defined something like this...
"fnServerData": function ( sUrl, aoData, fnCallback, oSettings ) {
oSettings.jqXHR = $.ajax( {
"url": sUrl,
....
"cache": false,
....
});
};
I want the value for "cache"
to be true
rather than false
. Am I missing something? Why is this hard-coded in like this? Is the best way to do make this change to edit the source either locally or by submitting a patch?
You can override the fnServerData callback: http://datatables.net/usage/callbacks#fnServerData
This actually helped me to solve my problem when already cached data (in redis) was re-cached by datatables (1.10.10), here's my code (it'll refresh the data as well and since it's cached it's super fast):