• 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

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

Show Custom Data in Woocommerce Order Details Admin Area

how to youtube api data to print in toolset metabox using a button click before save-post

Nginx disallowing execution of PHP in uploads directory with Magento

codeigniter 4 running error first time with xampp

Attempt to read property "view" on null when sending password reset email

Ajax GET request fails in laravel 8

how to redirect the user back to desired URL after login page in PHP?

How to Create WooCommerce Subscription Product via. REST API?

PHP - Check if string contains words longer than 4 characters, then include "+ *", and for those shorter than 4 characters include only "*"

PHP: How to quickly split a key=value file into associative array

Mobile browsers are adding .html to filename on download

php curl_exec() Connection refused when retrieving a remote image

What is the difference between client-side and server-side programming?

Call to a member function givePermissionTo() on null

About Contact Privacy policy Terms and conditions