• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How can I get new CSRF token in LARAVEL by using ajax

phpjqueryajaxlaravel-5


PHP Snippet 1:

<script type="text/javascript">
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                }
            });
</script>

PHP Snippet 2:

<meta name="_token" content="{!! csrf_token() !!}" />

Related Snippets

Make Shipping Method fields Mandatory on Woocommerce checkout page

Display specific shipping method if woocommerce product has specific acf field value

Converting array to string and then back in PHP

Make certain characters of a word from string bold

Clear javascript source cache laravel 5.8

Convert regular text to array using notepad++

Cache clear probem in Larave

Login if user is active using Laravel Breeze

Apply session id from request header

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

Get latest Tweets - What API

Symfony process run throws exception - executing on command line works

Creating Combinations of Elements

PHP how to detect if running on arm64 cpu?

How do I pass the dynamic output of a php variable or php function to a CSS variable?

About Contact Privacy policy Terms and conditions