why datatables not display data but display loading after get API
why datatables not display data but display loading after get API

i mean to get data from url : http://cobakki.online/APInsp/public/api/rew_puni/status/1 but datatable not display data
below my code :
$('#example').DataTable({
ajax: {
url : "http://cobakki.online/APInsp/public/api/rew_puni/status/1",
dataSrc : function(json){
json = json.parse(json);
return json.data;
}
},
columns: [
{ "data": "id_pelanggaran" },
{ "data": "kode_pelanggaran" },
{ "data": "ket_pelanggaran" },
{ "data": "nilai" },
{ "data": "status" },
],
});
please help me, thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @abdurahmanrizal13 ,
You just need to set the
ajax.dataSrc
to be empty as the data is in the top-level, something like:Cheers,
Colin
thanks for your help @colin