• 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

Load a .env file with PHP

Using PHP to connect to a remote MSSQL database

Detect if PHP session exists

PHP function Not Working As Expected From functions.php Include File

getting error while enter Command => php artisan route:list

How do I enable error reporting in Laravel?

How to create laravel storage symbolic link for production or sub domain system?

mysql slow on updates for a well optimized query

php curl_exec() Connection refused when retrieving a remote image

wordpress function breaks wp-admin

Laravel: Create morphs() relationship nullable

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

Eloquent insert id with sequence next value

PHP password_verify

How to disable only_full_group_by option in Laravel

About Contact Privacy policy Terms and conditions