Relative Content

Tag Archive for javascriptphpcodeignitercodeigniter-4csrf-token

CSRF token for AJAX call in attached javascript file

I’m working in Codeigniter 4 with CSRF protection enabled. I have an AJAX call in an attached js file, and I can’t figure out how to generate the CSRF token. Previously, I have done it in php files with embedded js, but in the attached js file I can’t run php.