• 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

Laravel Sanctum CSRF not authenticating

PHP: set a (deep) array key from an array [closed]

I want to use codeigniter foreign character library in my custom PHP project how i can use it?

Laravel MSSQL Server Connection not working

browsersync doesn't work with XAMPP

Implode array with array of glue strings

Laravel dosen't connect with Oracle

Component install error: JInstaller: :Install: File does not exist

PHP error: "The zip extension and unzip command are both missing, skipping."

How can I create a Download Page with post php method?

How to create custom authentication in laravel 8?

Cut an arabic string

loop through an anchor id

How can I easily switch between PHP versions on Mac OSX?

PHPSpreadsheet - How Do I Use Auto Migration Tool

About Contact Privacy policy Terms and conditions