• 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 override htaccees file for cache control header

PHP how to detect if running on arm64 cpu?

WAMP Virtual Host not working

Getting values for an enum?

Add custom text under order details on WooCommerce My account view order pages

Pass an image through AJAX [duplicate]

Laravel with App Engine Standard Class 'FacadeIgnitionIgnitionServiceProvider' not found

Limit of log line written to Apache Errorlog from mod php error_log

Spam Filter in Contact Form

Multiple order by in WooCommerce

Sort multidimensional array by column value within a column

Access denied for user 'homestead'@'localhost' (using password: YES)

Unable to create lockable file - Laravel 8 & PHP 8

Nginx RTMP not recording

Parsing JSON File to array in PHP

About Contact Privacy policy Terms and conditions