json formatting error
json formatting error
bpeterson76
Posts: 11Questions: 0Answers: 0
I've got close to 100 instances of DataTables out there, so you'd think I would have seen it all.....
I'm getting a consistent JSON formatting error on a server-side instance. I've verified that the JSON output (built by PHP) is valid at JSONLint. I've simplified the JSON string to just one word per element with no additional characters between the quotes. I've trimmed and done other things to ensure that it's not kicking out extra whitespace or non-html characters. There's no headers in my JSON output page, no HTML declaration, nothing extra to make it mess up. I've copied different versions of my the datatable instantiation code from known other sites. All, no dice.
The one thing that --DOES-- work is to copy the output from the JSON page, paste it back into that page, turn off the code for the PHP output...then it works. But, in theory by copying the output code and having that same output display, there should be no differences between the two.
Here's the code:
[code]{ "iTotalRecords":2, "iTotalDisplayRecords":2, "aaData":[["name", "subject", "date", "stuff"],["name", "subject", "date", "stuff"]]}[/code]
[code]oTable = $('#existingemails').dataTable( {
"aaSorting": [[ 1, "asc" ]],
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "view/ajaxDispatcher.php?action=getEmails&medium_type=email",
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bAutoWidth": false,
"bFilter":false,
"bLengthChange": true,
"bPaginate": true,
"bSort": true,
"iDisplayLength": 10,
"bInfo": true,
"aoColumns": [
{ "sTitle": "First", "sWidth": "25%" , "sClass":"center"},
{ "sTitle": "Last", "sWidth": "25%", "sClass":"center" },
{ "sTitle": "Not Attending", "sWidth": "10%", "sClass":"center" },
{ "sTitle": "Action", "sWidth": "20%", "sClass":"left" }
]
});[/code]
I'm getting a consistent JSON formatting error on a server-side instance. I've verified that the JSON output (built by PHP) is valid at JSONLint. I've simplified the JSON string to just one word per element with no additional characters between the quotes. I've trimmed and done other things to ensure that it's not kicking out extra whitespace or non-html characters. There's no headers in my JSON output page, no HTML declaration, nothing extra to make it mess up. I've copied different versions of my the datatable instantiation code from known other sites. All, no dice.
The one thing that --DOES-- work is to copy the output from the JSON page, paste it back into that page, turn off the code for the PHP output...then it works. But, in theory by copying the output code and having that same output display, there should be no differences between the two.
Here's the code:
[code]{ "iTotalRecords":2, "iTotalDisplayRecords":2, "aaData":[["name", "subject", "date", "stuff"],["name", "subject", "date", "stuff"]]}[/code]
[code]oTable = $('#existingemails').dataTable( {
"aaSorting": [[ 1, "asc" ]],
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "view/ajaxDispatcher.php?action=getEmails&medium_type=email",
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bAutoWidth": false,
"bFilter":false,
"bLengthChange": true,
"bPaginate": true,
"bSort": true,
"iDisplayLength": 10,
"bInfo": true,
"aoColumns": [
{ "sTitle": "First", "sWidth": "25%" , "sClass":"center"},
{ "sTitle": "Last", "sWidth": "25%", "sClass":"center" },
{ "sTitle": "Not Attending", "sWidth": "10%", "sClass":"center" },
{ "sTitle": "Action", "sWidth": "20%", "sClass":"left" }
]
});[/code]
This discussion has been closed.