How do I intercept an ajax call and pass additional parameters fnParams fnServerData details
How do I intercept an ajax call and pass additional parameters fnParams fnServerData details
gc_retrogress
Posts: 4Questions: 2Answers: 0
Here is my code...
jQuery(function() {
var table = jQuery('#example').dataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "serverside",
"dataSrc": "jsondata"
},
"fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
oSettings.jqXHR = $.ajax( {
"dataType": 'json',
//"type": "POST",
"url": "serverside",
"data": aoData,
//"success": fnCallback
} );
},
"aoColumnDefs": [{
mData: "Id",
sType: "integer",
aTargets: [0]
}, {
mData: "SerialId",
sType: "integer",
aTargets: [1]
}, {
mData: "critical",
sType: "string",
aTargets: [2],
}
],
});
This discussion has been closed.
Answers
Ok I solved the problem by using jQuery.ajaxSend(), I could not figure out datatable option...althougth I think preXhr event was close to helping me out..anyway here it is
Don't use
ajax
in combination withfnServerData
- the two are mutually exclusive. Use onlyajax
to provide your own Ajax call, or better yet, if you just want to add extra data, simply useajax.data
.Allan