I can’t update because it appears that this request has no response data available, but when I run it with print_r the data appears, and when I set the update data query builder, the error appears. please help me..
var id = $('#id').val();
var akses_lihat = $('#akses_lihat').val();
$.ajax({
url: '<?php echo base_url('User_Akses/update_akses') ?>',
method: 'POST',
dataType: 'JSON',
data: {
id: id,
akses_lihat: akses_lihat
},
success: function(data) {
}
});
public function update_akses($id, $akses_lihat) {
return $this->db->where('id', $id)->update('data_users_akses', array('akses_lihat' => $akses_lihat));
}
the hope is that my task will be completed quickly and found a good solution
2
Answers
Change the model function like below. Ajax expects to return
JSON
. But your model returnTRUE/FALSE
That’s because you are not sending a valid
json
response from yourcontroller
. For that:See
output
class details here