Problem with DataTables server-side processing example
Problem with DataTables server-side processing example
Hi All,
I am trying to use the example code for "DataTables server-side processing example" in coldfusion
but it seems there in some problem with JSON data. Please take a look below for my code.
[quote]Page Name:dataTable5.cfm(This is the main page)[/quote]
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
DataTables live example
@import "media/css/demo_page.css"; @import "media/css/demo_table.css";
Rendering engine
Browser
Platform(s)
Engine version
CSS grade
$(document).ready(function() {
$('#ajaxExample').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "ProcessData.cfm"
} );
} );
[/code]
[quote]Page Name:ProcessData.cfm[/quote]
[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]
[quote]Error Message:DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error [/quote]
1>This is first time i am using dataTable and i am new to jquery also. So please help me.
Thanks,
Saurav
I am trying to use the example code for "DataTables server-side processing example" in coldfusion
but it seems there in some problem with JSON data. Please take a look below for my code.
[quote]Page Name:dataTable5.cfm(This is the main page)[/quote]
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
DataTables live example
@import "media/css/demo_page.css"; @import "media/css/demo_table.css";
Rendering engine
Browser
Platform(s)
Engine version
CSS grade
$(document).ready(function() {
$('#ajaxExample').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "ProcessData.cfm"
} );
} );
[/code]
[quote]Page Name:ProcessData.cfm[/quote]
[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]
[quote]Error Message:DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error [/quote]
1>This is first time i am using dataTable and i am new to jquery also. So please help me.
Thanks,
Saurav
This discussion has been closed.
Replies
Allan
FireBug Details:
[quote]
Rsponse:
[/quote]
[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]
Allan
http://datatables.net/release-datatables/examples/data_sources/server_side.html
Because the example given there is not correct. I am getting [quote] Unexpected token [/quote]
error when i am checking it in http://jsonlint.com/
Allan