DataTables (serverSide) OK on first request, fails with "[Object object"] in request when searching or reordering
I was unable to reproduce using the specified parameters, but think that I may have a workaround anyhow. You can explicitly tell DataTables how to serialize the request data.
For example:
$(document).ready(function () { $('#mwe_table').DataTable({ processing: true, serverSide: true, ajax: { url: '/client/rou/ajax/mwe', data: function (d) { console.log(d); // display all properties to console return jQuery.param({ start: d.start, length: d.length, orderColumn: d.order[0].column, orderDir: d.order[0].dir, draw: d.draw }); } }, "columns": [ { "data": "client_user_id" }, { "data": "status" }, { "data": "lastname" }, { "data": "email_address" }, { "data": "client_id" }, { "data": "last_login" } ] });});
Notice that I am selectively sending some parameters by serializing a JavaScript object into application/x-www-form-urlencoded
using jQuery.param()
. For simplicity, the JavaScript object only has simple properties and no nested objects or arrays. The call to jQuery.param()
is probably unnecessary, but I left it in to be explicit.