Ajax event - fired before an Ajax request is made (edit)

https://datatables.net/reference/event/preXhr

https://nunofpjacinto.wordpress.com/jquery-datatable/

https://dotblogs.com.tw/shadow/2018/04/03/060340 (HAY)

https://www.manongdao.com/article-96869.html (HAY)

$('.table').on('preXhr.dt', function(e, settings, data){
    ...
});

table = $('#tblProjectList').on('preXhr.dt', function (e, settings, data) {
data.ID = $("#dropdownOrganization").val();
data.StartDate = $("#datepicker-startdate").val();
data.EndDate = $("#datepicker-enddate").val();
console.log('preXhr', data);
console.log('preXhr.dt', data);
}).DataTable({
"ajax": {
"type": "GET",
"url": window.UrlActionGetDataSearchProject,
"datatype": "JSON",
},
"processing": true,
...

https://datatables.net/forums/discussion/33598/prexhr-dt-not-fired-on-first-ajax-request-after-page-load

https://stackoverflow.com/questions/31475497/jquery-datatables-event-prexhr-dt-doesnt-fire


$
('table').on('preXhr.dt', function(e, settings, data){
$('#<table-id>').on('preXhr.dt', function(e, settings, data){
$('.<table-class>').on('preXhr.dt', function(e, settings, data){
$(document).ready(function() {
  $('#tableId').on('preXhr.dt', function ( e, settings, data ) {
    // before ajax call 
    ...
  } ).on('xhr.dt', function ( e, settings, json ) {
    // after ajax call 
    ...
  } ).dataTable( {
    "processing": true,
    "serverSide": true,
    "ajax": { 
        "url": "/server_processing/",
        "data": function(data){
            return "param="+JSON.stringify(data); 
        }
    }
  });
});