ResourceController and CSRF Token - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: ResourceController and CSRF Token (/showthread.php?tid=84818) |
ResourceController and CSRF Token - kbgkgould - 11-12-2022 I am trying to use the ResourceController to perform and update (PUT) via an AJAX call and I would like to update the CSRF token value and return that to the browser to allow the user to perform and second update on the form without having to do a full refresh of the form. Using the standard controller I am able to build my response data to include the 'csrf_token' => csrf_hash(), data and then update the hidden value in the form (using the form.open etc.) using JQuery. I would like to do the same using the ResourceController since it handles the update of the DB table values very easily. When I look at the value of the $result it only contains the OK/200 that I can see. // Handles PUT Request // Handles PATCH Request public function update($client_id = null) { $updateData = $this->request->getJSON(true) ; $result = $this->respond($this->model->where('primary_user_id',$this->user_id)->update($client_id, $updateData)); return $result ; } |