• 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 get array values using foreach in laravel

Match single unknown parameter php (Morse-code Regex)

How to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?

JSON Render Issue in Date Object Laravel and PHP 7.4

Laravel get user data with profile

Shortcode or PHP inside a shortcode in Wordpress

Detect a fetch request in PHP

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

Edit product hook WooCommerce

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

how can I set a session variable in Drupal 8 and get it in a php script?

Laravel multi auth - Authentication user provider [] is not defined

Dropzone: Submit both form data and dropzone at once

Applying programmatically a coupon to an Order in WooCommerce3

ORA-12546: TNS:permission denied error connection to remote oracle server

About Contact Privacy policy Terms and conditions