JSONP data source for remote domains
JSONP data source for remote domains
Dear developers!
I got errors when using jsonp for remote domains:
The error message:
SyntaxError: missing ; before statement
The warning message:
DataTables warning: table id=table1 - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
The javascript:
$(document).ready(function() {
$('#example').dataTable( {
"processing": true,
"serverSide": true,
"ajax": {
"url": "https://xxx.xx.xx.x:8443/jms/dic/test",
"dataType": "jsonp"
}
} );
} );
the reponse from server:
{
"recordsFiltered": 100000000,
"data": [
[
"co1_data0",
"col2_data0"
],
[
"co1_data1",
"col2_data1"
],
[
"co1_data2",
"col2_data2"
]
],
"draw": 1,
"recordsTotal": 100000000
}
Answers
Dear developers! I got errors when using jsonp for remote domains:
The error message: SyntaxError: missing ; before statement
The warning message: DataTables warning: table id=table1 - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
The javascript:
the reponse from server:
That isn't JSONP... You need to update the server-side script to return JSONP if you want to use JSONP.
Allan
Allan, Many thanks! I am able to make it works now.