!My update is not working but I using the same code in its website. https://mbahcoding.com/tutorial/php/codeigniter/codeigniter-ajax-crud-modal-server-side-validation.html
My update chrome in the network preview
sample website update chrome in the network preview
Here is ajax update on network response. enter image description here
I try normal way to do it but always have an error.
controller......
public function ajax_update()
{
$data = array(
'book_title' => $this->input->post('book_title'),
'book_isbn' => $this->input->post('book_isbn'),
'book_yop' => $this->input->post('book_yop'),
'book_active' => $this->input->post('book_active'),
'author_name' => $this->input->post('author_name'),
'publisher_name' => $this->input->post('publisher_name'),
);
$this->user_model->update_book(array('book_id' => $this->input->post('book_id')), $data);
echo json_encode(array("status" => TRUE));
}
model..........
public function update_book($data, $where)
{
$this->db->update('books',$data,$where);
return $this->db->affected_rows();
}
If I print_r($data); blew is the result. I think my issue is data is not passed to the database.
