• 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

MOODLE: What does it mean to aggregate h5p assets?

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

How to get rid of ampersand using WP Nonce URL and WP Redirect or PHP header

how to validate form data in codeigniter 4

Symfony Error: "An exception has been thrown during the rendering of a template"

PHPExcel_IOFactory::createWriter causes wrong behaviour

Toggle between a textbox and a select using PHP

Modify microseconds of a PHP DateTime object

PHP Print to Network Printer

PHP7 CLI attempts to load xdebug twice - "Cannot load Xdebug - it was already loaded"

Show rotation of tweets using current day of month

Create tags in laravel post publishing

php echo remove slashes from url [duplicate]

Manage independently the decimal number of the price of each product [duplicate]

Get latest Tweets - What API

About Contact Privacy policy Terms and conditions