• 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 5.1 xmlHttpRequest AJAX POST TokenMismatchException

Xdebug in Laravel is not working with VSCode

find in set in laravel ? example

SMTP ERROR: MAIL FROM command failed: 530 5.7.0 Must issue a STARTTLS command first when using PHPMailer

Remove "estimated for {country}" text after tax amount in Woocommerce checkout page

PHP: remove filename from path

How to read laravel_session cookies saved in cookie memory of browser in client side?

Custom Button next to “ADD TO CART” button of WooCommerce based on Product Type

Render the content of default_filter.php in Joomla front-end

PHP SoapClient: set a namespace without prefix

PHP: Insert marker every 3 iterations

Laravel 5.1 how to use {{ old('') }} helper on blade file for radio inputs

Exact alternate to mcrypt_encrypt in PHP 7.2

virtctl works when executed via command line but not from php exec()

Extract house numbers from address string

About Contact Privacy policy Terms and conditions