• 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

Boolean assignment operators in PHP

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

Connecting an HTML webpage to a SQL Server

correct PHP headers for pdf file download

protect my blog content

Shopify password update using Shopify API

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

In PHP, which is faster: preg_split or explode?

*** ERROR *** The PHP configuration loaded file is: c:/wamp64/bin/php/php8.1.0/php.ini - should be: c:/wamp64/bin/apache/apache2.4.53.1/bin/php.ini

Make Shipping Method fields Mandatory on Woocommerce checkout page

How avoid Moved Permanently The document has moved here

How to read laravel_session cookies saved in cookie memory of browser in client side?

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

How to loop a tree array with unknown depth and get array blocks?

PHP: Insert marker every 3 iterations

About Contact Privacy policy Terms and conditions