35 lines
924 B
JavaScript
35 lines
924 B
JavaScript
var table = $('#table-list').DataTable({
|
|
"ajax": {
|
|
"url": "http://localhost:11000/api/read",
|
|
"type": "POST",
|
|
"dataSrc": "data",
|
|
"contentType": "application/json",
|
|
"data": function (d) {
|
|
return JSON.stringify({});
|
|
},
|
|
"error": function (xhr, error, thrown) {
|
|
console.error("Error fetching data:", thrown);
|
|
console.error("Response:", xhr.responseText);
|
|
}
|
|
},
|
|
"columns": [
|
|
{
|
|
"data": "id",
|
|
"render": function (data, type, row) {
|
|
return data;
|
|
}
|
|
},
|
|
{
|
|
"data": "name",
|
|
"render": function (data, type, row) {
|
|
return data;
|
|
},
|
|
},
|
|
{
|
|
"data": "phone",
|
|
"render": function (data, type, row) {
|
|
return data;
|
|
},
|
|
},
|
|
],
|
|
}) |