Load search data in datatable after button click with extra parameter (server side paging)

Load search data in datatable after button click with extra parameter (server side paging)

mahbubmahbub Posts: 1Questions: 1Answers: 0

Hi,
I have successfully load data with server side pagination at page loading.But now, I want to load data when user click search button with search criteria. I have initialized as:
var dtable = $('#datatable').DataTable({
"processing" : true,
"pageLength" : 15,
"lengthMenu" : [ 15, 30, 45 ],
/* "serverSide" : true, */
"pagingType" : "full_numbers",
});
It shows datatable with empty data. Search Button click event is as follows:
$('#search').on('click', function(){
$.ajax({
type: 'POST',
url : path + "/userList",
success: function(data) {
dtable.clear().draw();
dtable.rows.add(data.data).draw();
}
});
});
Error occurs when button click beacuse i can not send datatable parameters used as paging , ordering, filtering , drawing. How can i achieve this. Any help is highly appreciable.
Thanks.

This discussion has been closed.