TypeError
TypeError
moec
Posts: 6Questions: 5Answers: 0
Hello all. I'm getting my info from a database, and I get the error TypeError: undefined is not an object (evaluating 'j[k].style').
Here is the code ajax code I'm using
$(document).ready(function() {
var table = $('#example').DataTable( {
"ajax": "includes/payroll.php",
"columns": [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ "data": "empNum" },
{ "data": "empName" },
{ "data": "appFlag"},
{ "data": "unitRate" },
{ "data": "salary" },
{ "data": "hourly"},
{ "data": "appr1"},
{ "data": "appr2"},
{ "data": "appr3"},
{ "data": "appr4"},
{ "data": "appr5"}
],
"order": [[1, 'asc']]
} );
and here is an example of an array I'm returning from the database
{
"data": [
{
"empNum": "1",
"empName": "BAKER, MARK E. ",
"unitRate": 0,
"salary": 3282.84,
"hourly": 0,
"appFlag": " ",
"app1": "K002 1 ",
"app2": " ",
"app3": " ",
"app4": " ",
"app5": " "
}
I don't know what I'm doing wrong or how to fix this. I've been searching and trying for about 6 hours now. Please help
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Can you link to a page showing the issue (as required in the forum rules) or use the debugger so we have some more information to debug the issue with please.
My guess is that the number of columns defined in the HTML does not match the number defined in your
columns
array (12).Allan