Welcome Guest, Not a member yet? Register   Sign In
Setting csrf_regenerate as TRUE
#10

First I spotted this on the jQuery website regarding ajaxSetup
Set default values for future Ajax requests. Its use is not recommended.

If I understand correctly, the use of this function will effect all following AJAX calls.
Once it has been declared the values are not updated.
So yes, I think this is the problem and you should not use it.

Create your own set and get functions for the CSRF

PHP Code:
<script type="text/javascript" language="javascript">
 
   var csfrData// Declare globally
 
   csfrTokenName '<?php echo $this->security->get_csrf_token_name(); ?>';
 
   csfrHash '<?php echo $this->security->get_csrf_hash(); ?>';

 
   setCSRF(csfrTokenNamecsfrHash);

 
   function setCSRF(namevalue) {
 
       csfrData = {}; // Reset csrfData to an empty array
 
       csfrData[name] = value;
 
   }

 
   function getCSRF() {
 
       return csrfData;
 
   }
</
script

And from the AJAX call you of course call the setCSRF function with the returned CSRF to update
Reply


Messages In This Thread
Setting csrf_regenerate as TRUE - by june123 - 07-27-2017, 04:45 AM
RE: Setting csrf_regenerate as TRUE - by june123 - 07-27-2017, 08:27 AM
RE: Setting csrf_regenerate as TRUE - by spjonez - 07-27-2017, 06:21 AM
RE: Setting csrf_regenerate as TRUE - by june123 - 07-28-2017, 01:36 AM
RE: Setting csrf_regenerate as TRUE - by june123 - 07-28-2017, 06:15 AM
RE: Setting csrf_regenerate as TRUE - by june123 - 07-28-2017, 11:50 PM
RE: Setting csrf_regenerate as TRUE - by Martin7483 - 07-29-2017, 06:47 AM
RE: Setting csrf_regenerate as TRUE - by june123 - 07-31-2017, 12:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB