JSON parsing error
JSON parsing error
stevenwright
Posts: 2Questions: 0Answers: 0
Trying to load table via JSON datasource. I have checked the JSON in JSONLint and it is valid. My debugger code is "emalik" and the page can be found http://shootoutbarrels.com/datatables/ and the datasource is http://shootoutbarrels.com/datatables/ajaxpagelist.
The page code is...
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
@import "<?= base_url() ?>/js/DataTables-1.9.3/media/css/demo_table.css";
$(document).ready( function () {
$('#dt_test').dataTable( {
"sAjaxSource": "<?= base_url() ?>/datatables/ajaxpagelist",
"aoColumns": [
{ "mdata": "pk_pages"},
{ "mdata": "name"},
{ "mdata": "ts"}
],
"sScrollY": "200px",
"bPaginate": false
} );
} );
DataTables Test
Key
Page Name
Timestamp
[/code]
The JSON is...
[code]
{
"page_count": 10,
"aaData": [
{
"pk_pages": "1",
"name": "home",
"ts": "2009-05-12 19:44:42"
},
{
"pk_pages": "3",
"name": "rules",
"ts": "2009-05-17 22:23:58"
},
{
"pk_pages": "2",
"name": "results",
"ts": "2009-05-17 20:47:26"
},
{
"pk_pages": "4",
"name": "draw",
"ts": "2009-05-19 22:14:52"
},
{
"pk_pages": "5",
"name": "entry_temp",
"ts": "2009-05-19 22:17:14"
},
{
"pk_pages": "6",
"name": "okc2008_q1",
"ts": "2009-05-19 22:42:57"
},
{
"pk_pages": "7",
"name": "okc2008_q2",
"ts": "2009-05-20 10:54:09"
},
{
"pk_pages": "9",
"name": "okc2008_y1",
"ts": "2009-05-20 13:38:14"
},
{
"pk_pages": "8",
"name": "okc2008_shootout",
"ts": "2009-05-20 12:33:43"
},
{
"pk_pages": "10",
"name": "okc2008_y2",
"ts": "2009-05-20 13:38:14"
}
]
}
[/code]
The page code is...
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
@import "<?= base_url() ?>/js/DataTables-1.9.3/media/css/demo_table.css";
$(document).ready( function () {
$('#dt_test').dataTable( {
"sAjaxSource": "<?= base_url() ?>/datatables/ajaxpagelist",
"aoColumns": [
{ "mdata": "pk_pages"},
{ "mdata": "name"},
{ "mdata": "ts"}
],
"sScrollY": "200px",
"bPaginate": false
} );
} );
DataTables Test
Key
Page Name
Timestamp
[/code]
The JSON is...
[code]
{
"page_count": 10,
"aaData": [
{
"pk_pages": "1",
"name": "home",
"ts": "2009-05-12 19:44:42"
},
{
"pk_pages": "3",
"name": "rules",
"ts": "2009-05-17 22:23:58"
},
{
"pk_pages": "2",
"name": "results",
"ts": "2009-05-17 20:47:26"
},
{
"pk_pages": "4",
"name": "draw",
"ts": "2009-05-19 22:14:52"
},
{
"pk_pages": "5",
"name": "entry_temp",
"ts": "2009-05-19 22:17:14"
},
{
"pk_pages": "6",
"name": "okc2008_q1",
"ts": "2009-05-19 22:42:57"
},
{
"pk_pages": "7",
"name": "okc2008_q2",
"ts": "2009-05-20 10:54:09"
},
{
"pk_pages": "9",
"name": "okc2008_y1",
"ts": "2009-05-20 13:38:14"
},
{
"pk_pages": "8",
"name": "okc2008_shootout",
"ts": "2009-05-20 12:33:43"
},
{
"pk_pages": "10",
"name": "okc2008_y2",
"ts": "2009-05-20 13:38:14"
}
]
}
[/code]
This discussion has been closed.
Replies
> The URI you submitted has disallowed characters.
So not valid JSON at all :-). Have a look at the return in Firebug or Inspector and you'll see that.
Allan