How to access data used by ajax for Server-side processing

How to access data used by ajax for Server-side processing

ketnaketna Posts: 8Questions: 4Answers: 0

I would like to use one class for sql queries for other views except table view (e.g. calendar). Other views should use the same filters, so the question is how could I access data like columns[i][search][value], which are being used for ajax calls?

Answers

  • kthorngrenkthorngren Posts: 20,142Questions: 26Answers: 4,736

    What language are you using for your server side?

    You could send the parameters as a JSON string using ajax.data. I think the last example in the docs show how.

    Kevin

  • ketnaketna Posts: 8Questions: 4Answers: 0

    Maybe I did not write precisely. I need to get these data in JS independently of Datatables ajax call, for other ajax call.

  • kthorngrenkthorngren Posts: 20,142Questions: 26Answers: 4,736

    You can get the data sent to the sever using the preXhr event.

    Kevin

  • ketnaketna Posts: 8Questions: 4Answers: 0

    I found this way:

    var dTable = $('#tablename').dataTable();
    var oSettings = dTable.fnSettings();
    var aoData = dTable._fnAjaxParameters(oSettings);
    console.log('data:'+JSON.stringify(aoData));

Sign In or Register to comment.