• 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

Split a string array into pieces

Call authenticate manually in router middleware

AJAX call fails with SyntaxError: Unexpected end of JSON input

Check for PDO Results, If None Display Message, If Yes then Loop Through

Jquery DataTables: Data not displaying in table via Ajax

Valet, Xdebug after reboot Big Sur not working

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

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

Php - Sum up the numbers in an array one by one

How to pass security cloudflare server with php curl

How to display table header in every page using FPDF library?

Make Shipping Method fields Mandatory on Woocommerce checkout page

Why does using salted hash on python and php give me different results?

GRPC installed successfully on ubuntu but php is looking for it in another folder

Reducing authentication calls on external API (Laravel 5.6)

About Contact Privacy policy Terms and conditions