How to turn off the anti-cache feature in 1.7

How to turn off the anti-cache feature in 1.7

YunYun Posts: 1Questions: 0Answers: 0
edited October 2010 in General
Hi Allan,

Our team is using your datatables, it works great!
After I upgrade it to 1.7.3, I found in the requested AJAX url there follows "?_=random number",
I think this is the "anti-cache" feature released in 1.7.
However, I'm using the CodeIgniter framework in PHP, and the CodeIgniter forbids the GET arrays.
I can't get data correctly if the URL follows with "?_=xxx".

So, could you tell me how to turn off the anti-cache feature in 1.7.3?

Many thanks!

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yes indeed, what you need to do is make use of the fnServerData callback function: http://datatables.net/usage/callbacks#fnServerData . DataTables uses the following by default:

    [code]
    $.ajax( {
    "url": url,
    "data": data,
    "success": callback,
    "dataType": "json",
    "cache": false,
    "error": function (xhr, error, thrown) {
    if ( error == "parsererror" ) {
    alert( "DataTables warning: JSON data from server could not be parsed. "+
    "This is caused by a JSON formatting error." );
    }
    }
    } );
    [/code]
    That can be modified as needed.

    Allan
This discussion has been closed.