I am using CodeIgniter as my web framework and from controller, I am using $this->load->view('Apartments_Hotels', $data to load data for the first time. But now I need to reload the page with new data using an ajax function in the view.
Ajax Function in the View
$(document).ready(function() {
$(".filter_checkbox").click(function(){
var filter = [];
$.each($("input[name='filter']:checked"), function(){
filter.push($(this).val());
});
$.ajax({
async: false,
type: 'POST',
data: {
filter: filter
},
url: "<?php echo base_url(); ?>index.php/ListingsController/showFilterListings",
success: function (response) {
}
});
});
});
Controller Function
public function showFilterListings(){echo $this->load->view('Apartments_Hotels', $data, TRUE);
}
But this is not working. Could anyone please help me with loading view again and again using ajax function