jquery datatables mysql jsp DataTables error DataTables warning: JSON data from could not be parsed -
I want to use jsp and mysql with jquery Liberty datatable. I try jsp based serverside processing (example) and get the error message:
Warning (table id = 'example') DataTables: DataTables Warning: JSON data can not be parsed from the server is . This is caused by a JSON formatting error.
In the example, there is a mysql database and the source on .jsp that should run on the server side. Clientside should not invoke that serveride .jsp to include a json message with the contents of the database, so I did some small adjustments to the clientside of a simular .php example.
& lt;! DOCTYPE HTML PUBLIC "- // W3C / / DTD HTML 4.01 // N" "http://www.w3.org/TR/html4/strict.dtd"> & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = utf-8" /> & Lt; Link rel = "shortcut icon" type = "image / ico" href = "http://www.sprymedia.co.uk/media/images/favicon.ico" /> & Lt; Title & gt; Databatab example 23 & lt; / Title & gt; & Lt; Style type = "text / css" title = "current style" & gt; @import "media / css / demo_page.css"; @import "media / css / demo_table.css"; & Lt; / Style & gt; & Lt; Script type = "text / javascript" language = "javascript" src = "media / js / jquery.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" language = "javascript" src = "media / js / jquery.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" language = "javascript" src = "media / js / jquery.dataTables.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" charset = "UTF-8" & gt; $ (Document) .ready (function () {$ ('# example') DataTable ({"bProcessing": true, "bServerSide": true, "sAjaxSource":. "Server_side_processing.jsp"})}) ; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body id = "dt_example" & gt; & Lt; Div id = "container" & gt; & Lt; Div class = "full_width large" & gt; & Lt; / Div & gt; & Lt; Div id = "dynamic" & gt; & Lt; Table cellpadding = "0" cellspacing = "0" limit = "0" square = "display" id = "example" & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; Width = "20%" & gt; Rendering engine & lt; / Th & gt; & Lt; Width = "25%" & gt; Browser & lt; / Th & gt; & Lt; Width = "25%" & gt; Platform (s) & lt; / Th & gt; & Lt; Width = "15%" & gt; Engine version & lt; / Th & gt; & Lt; Width = "15%" & gt; CSS grade & lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt; TR & gt; & Lt; Td colspan = "5" class = "dataTables_empty" & gt; Loading data from server & lt; / Td> & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; Tfoot & gt; & Lt; TR & gt; & Lt; Th & gt; Rendering engine & lt; / Th & gt; & Lt; Th & gt; Browser & lt; / Th & gt; & Lt; Th & gt; Platform (s) & lt; / Th & gt; & Lt; Th & gt; Engine version & lt; / Th & gt; & Lt; Th & gt; CSS grade & lt; / Th & gt; & Lt; / TR & gt; & Lt; / Tfoot & gt; & Lt; / Table & gt; & Lt; / Div & gt; & Lt; Div class = "spacer" & gt; & Lt; / Div & gt; & Lt; Div id = "footer" style = "text-align: center;" & Gt; & Lt; Span style = "font-size: 10px;" & Gt; Datatiles & amp; Copy; Alan Jardin 2008-2010 & lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;
The error indicates that there is a problem with Jason Parsing, so in this way I used the Firebug to look at a look at the Jason's response server. Here results:
{"iTotalDisplayRecords": 57, "iTotalRecords": 57, "aaData": [["Lizard", "Firefox 1.0", "Win 98+ \ / OSX.2 "" Gecko "," Firefox 1.5 "," Win 98+ \ / OSX.2 "," 1.8 "," A "], [" Lizard "," Firefox 2.0 "" Win 98 + \ / OSX.2 + "," 1.8 "," A "], [" Lizard "," Firefox 3.0 "," Win 2k + \ / OSX.3 + "," 1.9 "" A "", "[Geico", "Camino 1.0", "OSX.2 +", "1.8", "A"], ["Gecko", "Kaminee 1.5", "OSX.3 +", "1.8" "A"], ["Lizard", "Netscape 7.2", "Win95+ / Mac OS 8.6-9.2", "1.7", "A"], ["Lizard", "Netscape Browser 8", "Win 98SE + "," 1.7 "," A "], [" Lizard "," Netscape Navigator 9 ", "Win 98+ \ / OSX.2 +", "1.8", "A"], ["Lizard", "Mozilla 1.0", "Win95 + \ / OSX.1 +", "1", "A" ]]}
The Jason message is valid for me and a check says Jsonlint. It is also valid that I have spent days searching for a solution and used datatable-debugger () But I do not have any idea. Can anyone help?
Comments
Post a Comment