using AJAX POST to fill my datatable
using AJAX POST to fill my datatable
Hi guys.
my problem is that my datatable don't fill by an AJAX POST.
the table is blank and it show "Processing...". my firebug don't show any error.
here is my returned json example data:
[code]
{
"sEcho": "1",
"iTotalRecords": "1",
"iTotalDisplayRecords": "1",
"aaData": [
[
"Examplenumber",
"Examplename",
"Examplename2",
"2012-01-27 16:18:50",
"0",
"Example Text"
]
]
}
[/code]
and here the js:
[code]
oTable = $('#instances_table').dataTable({
'bFilter' : true,
'bProcessing' : true,
'bServerSide' : true,
'sAjaxSource' : 'get_user_instances_ajax',
'fnServerData' : function ( sSource, aoData, fnCallback ) {
aoData.push(
{ "name": "id", "value": $.trim( $('#id_instances').val().toString()) },
);
$.ajax({
'dataType' : 'json',
'type' : 'POST',
'url' : sSource,
'data' : aoData,
'success' : function(json) {
fnCallback(json);
}
});
},
'bPaginate' : false,
'bLengthChange' : false,
'iDisplayLength' : 25,
'bSortClasses' : true,
}
[...]
[/code]
have anybody an idea what i make false?
my problem is that my datatable don't fill by an AJAX POST.
the table is blank and it show "Processing...". my firebug don't show any error.
here is my returned json example data:
[code]
{
"sEcho": "1",
"iTotalRecords": "1",
"iTotalDisplayRecords": "1",
"aaData": [
[
"Examplenumber",
"Examplename",
"Examplename2",
"2012-01-27 16:18:50",
"0",
"Example Text"
]
]
}
[/code]
and here the js:
[code]
oTable = $('#instances_table').dataTable({
'bFilter' : true,
'bProcessing' : true,
'bServerSide' : true,
'sAjaxSource' : 'get_user_instances_ajax',
'fnServerData' : function ( sSource, aoData, fnCallback ) {
aoData.push(
{ "name": "id", "value": $.trim( $('#id_instances').val().toString()) },
);
$.ajax({
'dataType' : 'json',
'type' : 'POST',
'url' : sSource,
'data' : aoData,
'success' : function(json) {
fnCallback(json);
}
});
},
'bPaginate' : false,
'bLengthChange' : false,
'iDisplayLength' : 25,
'bSortClasses' : true,
}
[...]
[/code]
have anybody an idea what i make false?
This discussion has been closed.
Replies