• 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

Read users and passwords from a txt file

How to convert a carbon into string, to take the date only?

MySQL default time format UTC or GMT?

Dropzone: Submit both form data and dropzone at once

Auto increment id JSON

api response laravel doesn't show

xdebug 3 not working in ubuntu 20.04 with docker

Load a .env file with PHP

Symfony run hint kernel.secret parameter not found

PHP file_get_contents function

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

MOODLE: What does it mean to aggregate h5p assets?

MySQL order by field in Eloquent

protect my blog content

Artisan, creating tables in database

About Contact Privacy policy Terms and conditions