ihue ihue - 2 months ago 4
Ajax Question

Datatable Server Side Ajax from API URL

I make a GET to an API, then I got 1000 accounts.

My sample data : https://jsonblob.com/57c08bb2e4b0dc55a4f0eec7

Sine Datatable website suggested, here is my settings

var account_table = $('#account-table').DataTable({
"processing": true,
"serverSide": true,
"ajax": "scripts/server_processing.php",
"deferLoading": 10,


For "ajax": "scripts/server_processing.php", since I am using API, can I just do

"ajax": "https://jsonblob.com/57c08bb2e4b0dc55a4f0eec7" ????

Will it work ? I hope someone can shed some light on this.


what you need is to get the data and instead of putting ajax data put something like this

    var accounts;
         url: "https://jsonblob.com/57c08bb2e4b0dc55a4f0eec7",
      }).done(function(data) {
         accounts = data.data;
     var account_table =  $('#account-table').DataTable({
       "processing": true,
       "serverSide": true,
       "data": accounts,
       "deferLoading": 10,