I am trying to get data into DataTables from AJAX source as below:
$('#DT').DataTable( {
"paging": false,
"processing": true,
"info": false,
"ajax": 'http://localhost:5000/get_data'
} );
It's working when the server provides data in this format as below:
{
"data": [
[
1,
"0FL0BW1MA",
"2018-03-24 15:00",
"Lisbon ,Lisboa ,Portugal",
"CMA CGM GEORG FORSTER",
"ADALV",
"2018-05-08 02:00",
"ADENC"
]
]
}
But the actual server sends response in JSON key:value format as follows:
{
"data": [
{
"containers": 4,
"destination_port": "2018-05-08 02:00",
"eta": "CMA CGM GEORG FORSTER",
"etd": "2018-03-24 15:00",
"loading_port": "Lisbon ,Lisboa ,Portugal",
"vessels": "0FL0BW1MA"
}
]
}
So, My question is how can I load the actual JSON data to data table?