• 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

image source not readable

Get latest Tweets - What API

Vimeo API: how to save a vimeo into a subfolder?

Lumen - Postgresql setup - Composer

how to get the header value, if we don't know the value because the value is random from the server

Apply filter array/return terms

MySQL default time format UTC or GMT?

Unit (real unit test) of test laravel relationship

oauth-private.key does not exist or is not readable

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

How to install php yaml on CentOs?

What is PHP's equivalent of JavaScript's "array.every()"?

SMTP "Error: DATA not accepted from server!" Opencart 2.3 on InMotionHosting

Clients authentication and user authentication with laravel

Cache clear probem in Larave

About Contact Privacy policy Terms and conditions