使用带有服务器端处理的 ajax 加载数据

 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
    });

MY_AJAX_ACTION_URL 的响应应严格遵循以下格式:

{
  "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"}
  ]
}

请注意,如果调用的输出与上述格式不匹配,则会导致 table 初始化出错。