• 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

How to load Codeigniter 4 lang file into an array variable

Laravel dosen't connect with Oracle

merge all files in directory to one text file

Clear javascript source cache laravel 5.8

Woocommerce Checkout - Add conditional field required if one field is filled

Laravel-fopen: failed to open stream: Permission denied

PHPSpreadsheet - How Do I Use Auto Migration Tool

PHP/HTML: Creating A SubMenu

How can I make good efficent AJAX live forms with just jQuery and

Laravel Nova, route not found

How to insert Google Adsense Code in PHP script?

Nginx disallowing execution of PHP in uploads directory with Magento

Detect emoticons in string

Invalid value in field "itemtype" in Google Search Console

protect my blog content

About Contact Privacy policy Terms and conditions