I am using AJAX to source my datatables data. However, I am getting the error:
unknown parameter '0' for row 0, column 0
because my ajax response object has more fields than what I defined in my table's initialization. Is there a way I can limit or specify what parts of the ajax response go into my datatable? Here's my javascript:
$.ajax({
type: "GET",
url: "/api/admin/employees",
success: function(data) {
$('#eployees').DataTable({
responsive: true,
data: data,
columns: [
{ title: "Name" },
{ title: "Position" },
{ title: "Office" },
{ title: "Extn." },
{ title: "Start date" },
{ title: "Salary" }
]
});
},
error: function(data, status, res) {
console.log('error...');
console.log(res);
}
});
Note - my data object contains 20 fields, but I only need the 6 that are defined below.
Can someone help? Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire