• 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

Google Gmail API - How to login programatically?

PHP AWS Cognito 'Error executing "SignUp" : ResourceNotFoundException : User pool client XXXX does not exist

How to use a PHP MVC Controller, one thats invoked by calling a URL, to call and execute more than one function? [duplicate]

I need to link Google Sheet with my Laravel

Session timeout in Yii2

Target Individual Form Instance/Counter Inside A PHP While Loop

Not able to override collapsible.js in magento 2

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

Why is this PHP array not the same?

Entity provider not working in security.yml php symfony3.4 ({"code":401,"message":"bad credentials"}.)

How to get median and quartiles/percentiles of an array in JavaScript (or PHP)?

jQuery Ajax Post with data

Upgrade PHP on AWS Linux

Laravel websockets AWS EC2 - Connection failed

PHP SoapClient: set a namespace without prefix

About Contact Privacy policy Terms and conditions