• 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 remove index.php and index from the URL using htaccess | PHP

How can I stop a symfony process which is listening on http://127.0.0.1:8000

Creating live search with AJAX and CodeIgniter

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

Get orders by date and status woocommerce

Don't show recurring price for WooCommerce subscriptions worth 0$

Laravel Nova, route not found

Is it possible to re-use an array taken from PHP via JSON in a $.ajax function?

PHP: convert all UTF-8 characters to HTML entities

Show date difference as "20" instead of "20 years ago"

How to write PHP in XSLT

Check If array is null or not in php

How to find phpcs current default standard

Chunk and transpose a flat array into rows with a specific number of columns

How to upload mpdf file after generating to s3 bucket in php

About Contact Privacy policy Terms and conditions