Colsole error with Ajax and Columns attribute
Colsole error with Ajax and Columns attribute
I am using the code below in document.ready to try and load my object data with Ajax. Without the Columns attribute it hits my endpoint but with it I get the error in the console below and it does not hit my end point
$('#playerTable').DataTable({
ajax: 'player/index1',
columns: [
{ data: 'LastName' },
{ data: 'FirstName' },
],
});
http://localhost:1234/lib/datatables/dist/js/jquery.dataTables.min.js:108:349
each@http://localhost:1234/lib/jquery/jquery.js:367:19
each@http://localhost:1234/lib/jquery/jquery.js:202:17
http://localhost:1234/lib/datatables/dist/js/jquery.dataTables.min.js:108:305
each@http://localhost:1234/lib/jquery/jquery.js:367:19
each@http://localhost:1234/lib/jquery/jquery.js:202:17
u@http://localhost:1234/lib/datatables/dist/js/jquery.dataTables.min.js:101:187
l.fn.DataTable@http://localhost:1234/lib/datatables/dist/js/jquery.dataTables.min.js:191:482
http://localhost:1234/Player:19278:35
mightThrow@http://localhost:1234/lib/jquery/jquery.js:3557:29
http://localhost:1234/lib/jquery/jquery.js:3625:12
undefined jquery.js:3841:18
Uncaught TypeError: fa is undefined
jQuery 8
<anonymous> http://localhost:1234/Player:19278
jQuery 2
jquery.dataTables.min.js:108:349
Answers
Start by making sure the number of columns in
columns.data
matches the number in HTML. If you still need help please post a link to your page or a test case replicating the issue so we can help debug.https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin