Hello,
I wanted to call a function getByClassAllreceipts on dropdown change event.
I have multiple dropdown bind to change event, the problem is that the function getByClassAllreceipts is called for every event and the dataTable doesn't change data of each event.
In simple word on this $("#classid, #feetypeid, #listtype").change event the DataTable data doesn't get changed, even in the preview it gets the data correctly in the last called ajax request.
Hope I have cleared the problem I am facing.
Please help.
What I have tried:
$("#classid, #feetypeid, #listtype").change(function(){
var listtype = $("#listtype").val();
var classid = $("#classid").val();
var feetypeid = $("#feetypeid").val();
$.ajax({
url : "<?php echo site_url('FeeReceipt/getByClassAllreceipts'); ?>",
method : "POST",
data : {classid: classid, feetypeid: feetypeid,listtype : listtype},
async : true,
dataType : 'json',
success: function(data)
{
dataTbl.DataTable({
data : data,
columns: [
{ data: 'id'},
{ data: 'rollno'},
{ data: 'name'},
{ data: 'age'},
return data;
}
}
]
});
}
});
return false;
});