I am working on a School Management system. I am just creating fetch student details by their class and section. I use ajax + codeigniter controller but I am unable to pass two variable in ajax call to perform 2 parameter search.
My Ajax Code
<script>
$(document).ready(function () {
$('#example').DataTable({
'paging': true,
'searching': true,
'ordering': true,
'autoWidth': false
});
$('#student').click(function (event) {
event.preventDefault();
var xclass = $('.sclass').val();
var section = $('.section').val();
//
$.ajax({
url: "<?php echo base_url(); ?>Admission/fetchStudent/",
type: "POST",
data: {'xclass': xclass, 'section':section},
datatype: 'json',
success: function (data) {
$("#resultlist").html(data);
}
});
});
}); //event.preventDefault();
</script>
My Controller
public function fetchStudent($class,$section){
$this->load->model('Admission_model');
$data = $this->Admission_model->fetchStudentmodel($class,$section);
echo '<pre>';
print_r($data);
exit();
echo json_encode($data);
}
My Model is
public function fetchStudentmodel($x,$y) {
$uid = $this->session->userdata('user_id');
$data = $this->db->select('*')
->from('student')
->where(['user_id' => $uid,'class'=>$x, 'section'=>$y])
->get();
if ($data->num_rows() > 0) {
return $data->result();
} else {
return 'No data Available';
}
}
See this image then you can understand what I want to do 
data: {'xclass': xclass}and u are not using this value in your controller as well, i think u are using slug from the url.{xclass:xclass, section:section}