I have a problem when sending data with ajax,in the URL it adds .php to my controller
need help :(
this is the AJAX script to make call to Welcome controller:
<script>
$(document).ready(function () {
$('#palier').change(function(){
var idf=$(this).val();
console.log(idf);
$.ajax({
url : "<?php echo base_url(); ?>"+"Welcome/affectation_exam",
type : "POST",
data:{idf:idf},
datatype:"text",
success:function(data){
$('#specialite').html(data);
// console.log(data);
}
});
});
})
</script>
in the controller i have :
public function affectation_exam($page='affectation des examens')
{
$data['title']=$page;
$this->load->model('Palier');
$this->load->model('Specialite');
$data['records']=$this->Specialite->get_specialite();
$data['palier']=$this->Palier->get_palier();
$this->load->view('template/main',$data);
echo $_POST["idf"];
}