• 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

Apply filter array/return terms

Send POST data via raw JSON with Postman

Pagekite error: FAIL: localhost:8080 is down

Get number of working days between two dates in PHP [duplicate]

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

Convert date and time to Jalali in Laravel

Symfony - "framework.test" config is not set to true

PHPExcel file download using AJAX call

php curl_exec() Connection refused when retrieving a remote image

Laravel UUID generation

SQL AVG() to 2 decimals

Unable to guess the mime type as no guessers are available Laravel 5.2

Add Class in html Dynamically in PHP

Add rows to Single product Additional information table in WooCommerce 3.6

Access relation of pivot table in Laravel

About Contact Privacy policy Terms and conditions