Welcome Guest, Not a member yet? Register   Sign In
ResourceController and CSRF Token
#1

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 ;
    }
Reply




Theme © iAndrew 2016 - Forum software by © MyBB