• 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

Laravel - How to properly generate unique slugs from article titles?

Parsing JSON File to array in PHP

how to upload binary image to sql server using php laravel

Pages are working fine on localhost but not running on the hosting server

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

Mysqli multi query error

php file upload scanning using clamav, permissions on /tmp/

hidden INPUT value not available in $_POST

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

Match csv filenames to table names and import

Laravel Nova Dependency Container what are the allowed resource properties other than id in dependsOn

mysql slow on updates for a well optimized query

Sentry + Laravel: how to log an already catched Exception?

Symfony redirect if already loggedin from login page

How to make a array inside array?

About Contact Privacy policy Terms and conditions