Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82145

AJAX Processing

$
0
0
I am trying to get load data from my server while including parameters from various form controls on the page. I was hoping that it would be as simple as using fnServerParams but the keys and values are always undefined in the XHR call. So I added the fnServerData option and used console.log to output aoData. The object has my data as expected, but still the XHR call has the items has undefined.

Table initialization

var d_table = $('#feed-monitoring-datatable').dataTable({
	"bProcessing": true,
	"bServerSide": true,
	"sAjaxSource": 'cur_feed_table_',
	"bPaginate": false,
	"bLengthChange": false,
	"bFilter": false,
	"bSort": false,
	"bInfo": false,
	"bAutoWidth": false,
	"sScrollX" : "100%",
	'aoColumns' : [
		{'mData' : 'executable'},
		{'mData' : 'basename'},
		{'mData' : 'id'},
		{'mData' : 'event_time'},
		{'mData' : 'status'},
		{'mData' : 'size'},
		{'mData' : 'pct_diff'}
	],
	'fnServerParams' : function(aoData){
		
		aoData.push( {'feed_types' : $('#feed-types').val() } );
		aoData.push( {'num_rows' :  $('#num-rows').val() } );
		aoData.push( {'num_days' : $('#num-days').val() } );
		
		return aoData;
	},
	'fnServerData' : function(sSource, aoData, fnCallback, oSettings){
		console.log(aoData);
		oSettings.jqXHR = $.ajax( {
		"dataType": 'json',
		"type": "GET",
		"url": sSource,
		"data": aoData,
		"success": fnCallback
	  } );
	},
});

This is what I see in the XHR output in Chrome's console:

sEcho:1
iColumns:7
sColumns:
iDisplayStart:0
iDisplayLength:-1
mDataProp_0:executable
mDataProp_1:basename
mDataProp_2:id
mDataProp_3:event_time
mDataProp_4:status
mDataProp_5:size
mDataProp_6:pct_diff
undefined:undefined
undefined:undefined
undefined:undefined

It makes no difference whether I use GET or POST
It makes no difference whether bProcessing is true or false


Any help would be appreciated.

Viewing all articles
Browse latest Browse all 82145

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>