• 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 insert Google Adsense Code in PHP script?

How can i call a function that executes an fpdf based on the choice of a form selector?

PHP array stringify

PHP to search within txt file and echo the whole line

Laravel eloquent update record without loading from database

How to solve cURL error 60: SSL certificate in Laravel 5 while Facebook authentication

How do I enable error reporting in Laravel?

Pages are working fine on localhost but not running on the hosting server

How to override header set in Apache config with more specific header in a virtual host

How to install PHP composer inside a docker container

WooCommerce Additional Information - if empty, hide

How do I truncate a decimal in PHP?

Make Shipping Method fields Mandatory on Woocommerce checkout page

jwt decode throws Invalid argument supplied for foreach() on php-jwt and codeignitor 4

find in set in laravel ? example

About Contact Privacy policy Terms and conditions