I am using DataTables 1.10
Does anyone know how to dynamically add a parameter to an ajax call before table.draw (), so my query has new parameters? I searched everywhere and cannot find the answer.
I have buttons that a person can click and send different parameters to the server on this button.
$('#mytable').DataTable({ iDisplayLength: 10, responsive: true, processing: true, serverSide: true, searching: false, bLengthChange: false, bProcessing: true, paging: true, ajax: { url: me.url, dataType: 'json', cache:false, type: 'GET', data: function ( d ) { $.extend( d, me.data); d.supersearch = $('.my-filter').val(); } }, columns: me.columns, columnDefs: me.renderer, initComplete: function() { } });
This all works great, but then I try to bind it to a button to pass in new options.
$('.button').on('click', function(){ var table = $('#mytable').DataTable(); table.ajax.params({name: 'test'}); <- I want to do something like this table.draw(); })
jquery datatables
bstras21
source share