uas-web-22412056/Widuri-Client/js/data.js
2025-07-15 15:20:21 +07:00

41 lines
1.0 KiB
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": "price",
"render": function (data, type, row) {
return data;
},
},
{
"data": "qty",
"render": function (data, type, row) {
return data;
},
},
],
})