Having Problem in fetching data to DataTable based on DropDown selected Value in CodeIgniter
Having Problem in fetching data to DataTable based on DropDown selected Value in CodeIgniter
nyt1972
Posts: 3Questions: 2Answers: 0
$("#classid").change(function(){
var sessionid = $("#sessionid").val();
var classid = $(this).val();
$('#example').DataTable({
ajax: {
url: "<?php echo site_url('Ajax/getStudents'); ?>",
type: "POST",
data: function(d){
d.sessionid = $("#sessionid").val();
d.classid = $("#classid").val();
}
},
dom: 'Bfrtip',
iDisplayLength: 15,
buttons: [
'copyHtml5',
'excelHtml5',
'csvHtml5',
'pdfHtml5',
'pageLength'
],
search: true
});
});
In Chrome Network its show the response as below:
[{"studentname":"Ali","fathername":"Ajmal","rollno":"101","mobile1":"222111"},{"studentname":"jamal","fathername":"kamal","rollno":"102","mobile1":"545454"}]
but not fetched to dataTable
Please help.
Answers
I resolved the problem, below is my solution: