Create websites with TailwindCSS
Design blocks for your website
Start building the next great SAAS
Alpine & Tailwind UI Library
Plug'n Play Authentication for Laravel
Create website designs with AI
Blog platform for developers
Build a simple static website
21-day program to build a SAAS
var csrf = document.querySelector('meta[name="csrf-token"]').content;
If you need to do an AJAX POST request in Laravel and you check out the documentation, you're likely to see the solution for retrieving the CSRF token in jQuery like so:
var csrf = $('meta[name="csrf-token"]').attr('content');
But... What if you just want to retrieve it in Vanilla Javascript? Simple enough, you can use the code below:
var csrf = document.querySelector('meta[name="csrf-token"]').content;
Hope that helps you out.
No explanation generated yet.