• 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

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

Symfony 4: "Autowire: you should configure its value explicitly."

How can I remove the "Advanced" panel of all blocks in WordPress block editor?

how to loop through json response data using ajax jquery?

How to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?

How to put php code inside opening and closing shortcodes

Custom Button next to “ADD TO CART” button of WooCommerce based on Product Type

How to convert binary string to normal string in php

How to create a scheduler application in php

add " ? " in url via htaccess RewriteRule

How to get quarter for future date using Carbon?

I want to store data in new index as per my key in php [duplicate]

PHP: PDO + CSV export not downloading (headers issue?)

Get Header Authorization value of a login api (sent with username and password in json body) using php curl

XML to CSV with PHP converter [problem with images grabing]

About Contact Privacy policy Terms and conditions