• 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

Facebook API, get page post link (PHP)

how to hide previous markers when new markers added in google map javascript api

Symfony redirect if already loggedin from login page

PHP block shortcut in Visual Studio Code

Laravel 5 session not persisting after user is logged in

Debugging Stripe Webhook Event

How can I make a full text index of the column?

How to get AJAX to post on second page?

httpd.conf on Windows: can't locate API model structure `php8_module`

Hide specific products from unlogged users based in product category in WooCommerce

Laravel 5.1 Unknown database type enum requested

How to install php yaml on CentOs?

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

How to Generate PDF invoice to XML format using mPDF

Unable to get password for the instance created from AMI

About Contact Privacy policy Terms and conditions