• 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

Submitting a form with ajax in Wordpress

How to change 'users' auth table and use another instead Laravel

Display a success custom notice after Placing an Order in WooCommerce

PHP drop down list using array's and foreach (else and for) code

Add record for each array elements if missing in table

Composer Warning: openssl extension is missing. How to enable in WAMP

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

How to get Laravel's CSRF Token from Another Website?

Laravel 8 factory state afterCreating

Zig-zag scan an N x N array

WooCommerce: Add/display Product or Variation custom field everywhere

Is it possible to re-use an array taken from PHP via JSON in a $.ajax function?

Transpose and flatten multiple rows of array data [duplicate]

Lumen - Postgresql setup - Composer

Display the default discounted price and percentage on Woocommerce products

About Contact Privacy policy Terms and conditions