Row Detail(Server-side) Datatable Example

Row Detail(Server-side) Datatable Example

tonjawtonjaw Posts: 1Questions: 0Answers: 0
edited December 2013 in DataTables 1.9
Hi
I just learn Row Detail (server-side) Example and find a problem with JSON parsing. At first I manage to grab the default example datas from mysql.php and send them to the browser. But when I switch mysql to postgres (postgres.php) for the database server, I found a "JSON data from server could not be parsed" message. I dont understand coz the array format of Mysql's and Postgres' is quite similar and I just change the "sAjaxSource" in row_details.html for both of it.
Here is the result of json_encode from mysql's array:
[quote]
{"sEcho":0,"iTotalRecords":"10","iTotalDisplayRecords":"10","aaData":[{"0":"","1":"Trident","2":"Internet Explorer 4.0","3":"Win 95+","4":"4","5":"X","extra":"hrmll"},{"0":"","1":"Trident","2":"Internet Explorer 5.0","3":"Win 95+","4":"5","5":"C","extra":"hrmll"},{"0":"","1":"Trident","2":"Internet Explorer 5.5","3":"Win 95+","4":"5.5","5":"A","extra":"hrmll"},{"0":"","1":"Trident","2":"Internet Explorer 6","3":"Win 98+","4":"6","5":"A","extra":"hrmll"},{"0":"","1":"Trident","2":"Internet Explorer 7","3":"Win XP SP2+","4":"7","5":"A","extra":"hrmll"},{"0":"","1":"Trident","2":"AOL browser (AOL desktop)","3":"Win XP","4":"6","5":"A","extra":"hrmll"},{"0":"","1":"Gecko","2":"Firefox 1.0","3":"Win 98+ \/ OSX.2+","4":"1.7","5":"A","extra":"hrmll"},{"0":"","1":"Gecko","2":"Firefox 1.5","3":"Win 98+ \/ OSX.2+","4":"1.8","5":"A","extra":"hrmll"},{"0":"","1":"Gecko","2":"Firefox 2.0","3":"Win 98+ \/ OSX.2+","4":"1.8","5":"A","extra":"hrmll"},{"0":"","1":"Gecko","2":"Firefox 3.0","3":"Win 2k+ \/ OSX.3+","4":"1.9","5":"A","extra":"hrmll"}]}
[/quote]
And here is the result of json_encode from Postgres' array:
[quote]
{"sEcho":0,"iTotalRecords":"9","iTotalDisplayRecords":"9","aaData":[{"0":"","1":"1388031340","2":"admin","3":"READ","4":"crot","5":"Dashboard","6":"-","7":"Firefox","extra":"hrmll"},{"0":"","1":"1388034351","2":"admin","3":"READ","4":"crot","5":"Dashboard","6":"-","7":"Firefox","extra":"hrmll"},{"0":"","1":"1388035453","2":"admin","3":"READ","4":"crot","5":"Dashboard","6":"-","7":"Firefox","extra":"hrmll"},{"0":"","1":"1388035548","2":"admin","3":"READ","4":"crot","5":"Dashboard","6":"-","7":"Firefox","extra":"hrmll"},{"0":"","1":"1388035742","2":"admin","3":"READ","4":"crot","5":"Dashboard","6":"-","7":"Firefox","extra":"hrmll"},{"0":"","1":"1388032144","2":"Localhost","3":"VIEW","4":"crot","5":"FE: Main Menu","6":"-","7":"Firefox","extra":"hrmll"},{"0":"","1":"1388035763","2":"admin","3":"READ","4":"crot","5":"Dashboard","6":"-","7":"Firefox","extra":"hrmll"},{"0":"","1":"1388035923","2":"admin","3":"READ","4":"crot","5":"Dashboard","6":"-","7":"Firefox","extra":"hrmll"},{"0":"","1":"1388035927","2":"admin","3":"READ","4":"crot","5":"Dashboard","6":"-","7":"Firefox","extra":"hrmll"}]}
[/quote]
Any thoughts? Thx

Replies

  • allanallan Posts: 63,493Questions: 1Answers: 10,470 Site admin
    Please link to a test case or use the DataTables debugger as noted in the forum rules and in the "New Discussion" form. See: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read

    The error you are getting means exactly what it says, there is a JSON error (this comes from jQuery, not DataTables). There must be something else in the return front he server, but without a test case I have absolutely no idea what. Sorry.
This discussion has been closed.