• 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 assert parameter attribute sub-structures in PHPUnit mock call expectations

Laravel excel maatwebsite 3.1 import, date column in excel cell returns as unknown format number. How to solve this?

php curl_exec() Connection refused when retrieving a remote image

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

using random function but it's displaying duplicates

passwordless LDAP login and get user information using Kerberos ticket in PHP

How to render html from a @foreach loop in a textarea

Laravel Livewire: jQuery not working in child component loaded via @if statement

Pass an image through AJAX [duplicate]

How to add a heading in between checkout fields of WooCommerce

php curl requesting twice

Wordpress add responsive srcset header image to theme

PHP array, move keys and values to new array, but mix it up

How to get total pages of PDF with FPDF?

Coinpayments create_transaction "ERROR: Invalid command!"

About Contact Privacy policy Terms and conditions