this is my js code which is executed on button click
$("#search_tutor").click(function(){
$("#show_tutors").hide();
var subject = $( ".subject" ).val();
var degree_level = $(".degree_level").val();
var city = $(".city").val();
console.log(subject);
console.log(degree_level);
console.log(city);
$.ajax({
url:"<?php echo base_url(); ?>public_controller/search_tutor_jquery",
method:"post",
data:{subject: subject, degree_level : degree_level, city : city},
success:function(data){
$('#search_results').html(data);
}
});
});
and this is controller function
public function search_tutor_jquery(){
$subject = strtolower($this->input->post('subject'));
$degree_level = strtolower($this->input->post('degree_level'));
$city = strtolower($this->input->post('city'));
echo $subject; //prints nothing
$data['filtered_tutors'] = $this->public_model->search($subject,$degree_level,$city);
$this->load->view('public/search_results',$data);
}
values are being logged in console but i cannot receive values in controller. can somebody help me out?
thanks in advance
2
Answers
Have you tried using
instead of
?
What do you mean by
Try
Read about
load()
function here. It sends a new empty request and load that data to your element. It doesn’t load the response.