• 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

Get sum of arrays inside array

Stop caching for PHP 5.5.3 in MAMP

How to execute sql code based on fetch array

Create tags in laravel post publishing

How to redirect to another page after n seconds in wordpress without using javascript?

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

Explain how this array transposing and flattening function works

enroll_table three field fetch to payment form to create payment field in laravel 5.5

php curl requesting twice

Unable to Edit config.inc.php

Shopify password update using Shopify API

Display a success custom notice after Placing an Order in WooCommerce

Exact alternate to mcrypt_encrypt in PHP 7.2

Create a zip file and download it

How to insert data from multiple select dropdown values into database?

About Contact Privacy policy Terms and conditions