datatables Server Side Data Processing Load data using ajax with server-side processing.


Example

 var MY_AJAX_ACTION_URL = "path/to/controller.php";

 var table = $('#user_list_table').DataTable({
        "autoWidth": true,
        "paging": true,
        "searching": true,
        "ordering": true,
        "language": {
          "zeroRecords": "No data Found",
          "processing": 'Loading'
        },
        "info": false,
        "stripeClasses": [ "odd nutzer_tr", "even nutzer_tr"],
        "columns": [
            {'data':'uid',"visible": false},
            {'data':'name','orderable': true},
            {'data':'phone','orderable': true},
            {'data':'email','orderable': true },
            {'data':'address','orderable': true}
        ],
        "order": [[ 1, "desc" ]],
        "processing": true,
        "serverSide": true,
        "ajax":MY_AJAX_ACTION_URL
    });

The response of the call to MY_AJAX_ACTION_URL should be strictly in the below format:

{
  "draw": 1,
  "recordsTotal": 2,
  "recordsFiltered": 2,
  "data": [
      {"name":"XYZ","phone":"678654454","email":"xyz@gmail.com","address":"true"},
      {"name":"ABC","phone":"678654455","email":"abc@gmail.com","address":"true"}
  ]
}

Note that if the output of the call fails to match the above format, it will result in an error in the initialization of table.