• 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

phpmyadmin : Depends: php-twig (>= 2.9) but 2.6.2-2 is to be installed. WHAT?

How to identify whether webp image is static or animated?

(PHPUnit) PHP Fatal error: Uncaught Error: Call to undefined function each()

Additional price based on cart item count in WooCommerce

"Mixed content blocked" when running an HTTP AJAX operation in an HTTPS page

Laravel 8 factory state afterCreating

Call authenticate manually in router middleware

Show Custom Data in Woocommerce Order Details Admin Area

"cannot list resources" error from WooCommerce REST API

PHP: Telegram Bot: Insert line break to text message

Is there a way to use the same parameter into multiple place in the same query with Eloquent? [duplicate]

how to prevent float variables displaying as scientific notation when printing [duplicate]

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

PhP how to calculate moments with variables rows

Shortcode or PHP inside a shortcode in Wordpress

About Contact Privacy policy Terms and conditions