【发布时间】:2019-10-31 11:37:45
【问题描述】:
!我的更新不起作用,但我在其网站上使用了相同的代码。 https://mbahcoding.com/tutorial/php/codeigniter/codeigniter-ajax-crud-modal-server-side-validation.html
我在网络预览中的更新 chrome
网络预览中的示例网站更新 chrome
这里是关于网络响应的 ajax 更新。 enter image description here
我尝试了正常的方法,但总是出错。
控制器……
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));
}
型号…………
public function update_book($data, $where)
{
$this->db->update('books',$data,$where);
return $this->db->affected_rows();
}
【问题讨论】:
-
请告诉我们您收到的错误信息。此外,识别错误的行会有所帮助
-
更新散文,使用
$this->db->set($data_array) -
没有错误信息,当我点击更新时没有任何变化。
-
在开发工具上,在网络预览中选择ajax_update请求然后选择response选项卡,并在此处报告结果
-
在 ajax_update 中只有雕像:true。
标签: php ajax codeigniter datatable