JSON data from server failed to load or be parsed
JSON data from server failed to load or be parsed
Hi All, I have been playing with this for a while now. I am using server side processing with asp.net. My java script is simple:
[code]
$(document).ready(function() {
$('#example').dataTable({
"bServerSide": true,
"sAjaxSource": "SS_process.aspx"
});
});
[/code]
My server side source returns valid JSON, I checked it with JSONLint.
[code]
{"aaData": [["Gecko","Epiphany 2.20","Gnome","1.8","A"],["Gecko","Seamonkey 1.1","Win 98+ / OSX.2+","1.8","A"],["Gecko","Mozilla 1.8","Win 98+ / OSX.1+","1.8","A"],["Gecko","Mozilla 1.7","Win 98+ / OSX.1+","1.7","A"],["Gecko","Mozilla 1.6","Win 95+ / OSX.1+","1.6","A"],["Gecko","Mozilla 1.5","Win 95+ / OSX.1+","1.5","A"],["Gecko","Mozilla 1.4","Win 95+ / OSX.1+","1.4","A"],["Gecko","Mozilla 1.3","Win 95+ / OSX.1+","1.3","A"],["Gecko","Mozilla 1.2","Win 95+ / OSX.1+","1.2","A"],["Gecko","Mozilla 1.1","Win 95+ / OSX.1+","1.1","A"],["Gecko","Mozilla 1.0","Win 95+ / OSX.1+","1","A"],["Gecko","Netscape Navigator 9","Win 98+ / OSX.2+","1.8","A"],["Gecko","Netscape Browser 8","Win 98SE+","1.7","A"],["Gecko","Netscape 7.2","Win 95+ / Mac OS 8.6-9.2","1.7","A"],["Gecko","Camino 1.5","OSX.3+","1.8","A"],["Gecko","Camino 1.0","OSX.2+","1.8","A"],["Gecko","Firefox 3.0","Win 2k+ / OSX.3+","1.9","A"],["Gecko","Firefox 2.0","Win 98+ / OSX.2+","1.8","A"],["Gecko","Firefox 1.5","Win 98+ / OSX.2+","1.8","A"],["Gecko","Firefox 1.0","Win 98+ / OSX.2+","1.7","A"],["Trident","AOL browser (AOL desktop)","Win XP","6","A"],["Trident","Internet Explorer 7","Win XP SP2+","7","A"],["Trident","Internet Explorer 6","Win 98+","6","A"],["Trident","Internet Explorer 5.5","Win 95+","5.5","A"],["Trident","Internet Explorer 5.0","Win 95+","5","C"],["Trident","Internet Explorer 4.0","Win 95+","4","X"],["Webkit","OmniWeb 5.5","OSX.4+","420","A"],["Webkit","Safari 3.0","OSX.4+","522.1","A"],["Webkit","Safari 2.0","OSX.4+","419.3","A"],["Webkit","Safari 1.3","OSX.3","312.8","A"]]}
[/code]
yet my display page gives me an error : JSON data from server failed to load....JSON formatting error.
Firebug does not give me an error on the GET:
[code]
https://xx.xx.xx.xx/ScottTest/reports/SS_process.aspx?_=1291749242133&sEcho=1&iColumns=5&sColumns=&iDisplayStart=0&iDisplayLength=10&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&iSortingCols=1&iSortCol_0=0&sSortDir_0=asc&bSortable_0=true&bSortable_1=true&bSortable_2=true&bSortable_3=true&bSortable_4=true
[/code]
I am at a bit of a loss where to turn next.
Thanks in advance.
[code]
$(document).ready(function() {
$('#example').dataTable({
"bServerSide": true,
"sAjaxSource": "SS_process.aspx"
});
});
[/code]
My server side source returns valid JSON, I checked it with JSONLint.
[code]
{"aaData": [["Gecko","Epiphany 2.20","Gnome","1.8","A"],["Gecko","Seamonkey 1.1","Win 98+ / OSX.2+","1.8","A"],["Gecko","Mozilla 1.8","Win 98+ / OSX.1+","1.8","A"],["Gecko","Mozilla 1.7","Win 98+ / OSX.1+","1.7","A"],["Gecko","Mozilla 1.6","Win 95+ / OSX.1+","1.6","A"],["Gecko","Mozilla 1.5","Win 95+ / OSX.1+","1.5","A"],["Gecko","Mozilla 1.4","Win 95+ / OSX.1+","1.4","A"],["Gecko","Mozilla 1.3","Win 95+ / OSX.1+","1.3","A"],["Gecko","Mozilla 1.2","Win 95+ / OSX.1+","1.2","A"],["Gecko","Mozilla 1.1","Win 95+ / OSX.1+","1.1","A"],["Gecko","Mozilla 1.0","Win 95+ / OSX.1+","1","A"],["Gecko","Netscape Navigator 9","Win 98+ / OSX.2+","1.8","A"],["Gecko","Netscape Browser 8","Win 98SE+","1.7","A"],["Gecko","Netscape 7.2","Win 95+ / Mac OS 8.6-9.2","1.7","A"],["Gecko","Camino 1.5","OSX.3+","1.8","A"],["Gecko","Camino 1.0","OSX.2+","1.8","A"],["Gecko","Firefox 3.0","Win 2k+ / OSX.3+","1.9","A"],["Gecko","Firefox 2.0","Win 98+ / OSX.2+","1.8","A"],["Gecko","Firefox 1.5","Win 98+ / OSX.2+","1.8","A"],["Gecko","Firefox 1.0","Win 98+ / OSX.2+","1.7","A"],["Trident","AOL browser (AOL desktop)","Win XP","6","A"],["Trident","Internet Explorer 7","Win XP SP2+","7","A"],["Trident","Internet Explorer 6","Win 98+","6","A"],["Trident","Internet Explorer 5.5","Win 95+","5.5","A"],["Trident","Internet Explorer 5.0","Win 95+","5","C"],["Trident","Internet Explorer 4.0","Win 95+","4","X"],["Webkit","OmniWeb 5.5","OSX.4+","420","A"],["Webkit","Safari 3.0","OSX.4+","522.1","A"],["Webkit","Safari 2.0","OSX.4+","419.3","A"],["Webkit","Safari 1.3","OSX.3","312.8","A"]]}
[/code]
yet my display page gives me an error : JSON data from server failed to load....JSON formatting error.
Firebug does not give me an error on the GET:
[code]
https://xx.xx.xx.xx/ScottTest/reports/SS_process.aspx?_=1291749242133&sEcho=1&iColumns=5&sColumns=&iDisplayStart=0&iDisplayLength=10&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&iSortingCols=1&iSortCol_0=0&sSortDir_0=asc&bSortable_0=true&bSortable_1=true&bSortable_2=true&bSortable_3=true&bSortable_4=true
[/code]
I am at a bit of a loss where to turn next.
Thanks in advance.
This discussion has been closed.
Replies
I had the same problem with a processing PHP page encoded in UTF-8. I've changed it to ANSI and it works great now!
Maybe it'll help!
Bye!
I have the same problem.
I use the example to test.
Both 'DataTables AJAX source example' and
'DataTables server-side processing example' can't get the result.
'DataTables server-side processing example' shows ' JSON data from server failed to load or be parsed'.
I use http://www.jsonlint.com/ to valid,the answer is valid.
JSON data:
[code]
{
"sEcho": 1,
"iTotalRecords": "57",
"iTotalDisplayRecords": "57",
"aaData": [
[
"Gecko",
"Firefox 1.0",
"Win 98+ \/ OSX.2+",
"1.7",
"A"
],
[
"Gecko",
"Firefox 1.5",
"Win 98+ \/ OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Firefox 2.0",
"Win 98+ \/ OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Firefox 3.0",
"Win 2k+ \/ OSX.3+",
"1.9",
"A"
],
[
"Gecko",
"Camino 1.0",
"OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Camino 1.5",
"OSX.3+",
"1.8",
"A"
],
[
"Gecko",
"Netscape 7.2",
"Win 95+ \/ Mac OS 8.6-9.2",
"1.7",
"A"
],
[
"Gecko",
"Netscape Browser 8",
"Win 98SE+",
"1.7",
"A"
],
[
"Gecko",
"Netscape Navigator 9",
"Win 98+ \/ OSX.2+",
"1.8",
"A"
],
[
"Gecko",
"Mozilla 1.0",
"Win 95+ \/ OSX.1+",
"1",
"A"
]
]
}
[/code]
It may be not the json data error, but some other reason.
It 's my fault, both work .