I have this ajax request
$.ajax({
type : 'POST',
url : '<?php echo base_url('Home_controller/editUser'); ?>',
data : { user_id : user_id, name : name, position : position, office : office, password : password, reports_to : reports_to, user_type : user_type, status : status },
dataType : 'json',
success : function(data){
$('#name' + numberId).html(this.name);
$('#position' + numberId).html(this.position);
$('#office' + numberId).html(this.office);
$('#password' + numberId).html(this.password);
$('#reports_to' + numberId).html(this.reports_to);
$('#user_type' + numberId).html(this.user_type);
if(this.status == 1){
$('#status' + numberId).html("Activated");
}
else if(this.status == 0){
$('#status' + numberId).html("Deactivated");
}
$('#edit_user_modal').modal('toggle');
},
error : function(errorw){
alert('Error');
}
});
This is my editUser method in my Home_controller
public function editUser(){
$user_id = $this->input->post('user_id');
$name = $this->input->post('name');
$position = $this->input->post('position');
$office = $this->input->post('office');
$password = $this->input->post('password');
$reports_to = $this->input->post('reports_to');
$user_type = $this->input->post('user_type');
$status = $this->input->post('status');
$this->home_model->updateUser($user_id, $name, $position, $office, $password, $reports_to, $user_type, $status);
$user_details = $this->home_model->getUserDetails($user_id);
echo json_encode($user_details);
}
I used alert
on all the values on my data and they are all correct. I also checked the url and it is correct. I wonder where did I go wrong? Can someone please help me.
This is the error jquery-2.2.1.js:9175 POST http://localhost/ppmp/Home_controller/editUser 500 (Internal Server Error)
. I tried to open the url in the error in a new tab and yes it can be found.
I'm stuck here for hours now. Thanks for the help.