CSRF + ajax/jquery problem |
You will need to return the new CSRF hash value to your ajax success method and use the value to update the hidden CSRF field.
In the controller you can use the security class to get the CSRF token name and hash like this PHP Code: $token = $this->security->get_csrf_token_name(); Then, assuming you will return json data, echo a json encoded array containing this info... and anything else needed to update the page. PHP Code: echo json_encode(array('token' => $token, 'hash' => $hash, 'other' => $something, 'more_stuff' => $more); Then, back at the .ajax success function, some javascript along these lines to update the CSRF field Code: success: function (results) { |
Messages In This Thread |
CSRF + ajax/jquery problem - by fedde - 09-08-2017, 09:58 AM
RE: CSRF + ajax/jquery problem - by dave friend - 09-08-2017, 02:44 PM
RE: CSRF + ajax/jquery problem - by fedde - 09-08-2017, 10:53 PM
|