• 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 pass data to all views in Laravel 5?

Exact alternate to mcrypt_encrypt in PHP 7.2

jQuery Ajax Post with data

Phalcon: setStatusCode returns empty response

Image upload not working through ajax Laravel

How to create a video stream from a single dynamic image in PHP

google content api for shopping

Pass an image through AJAX [duplicate]

How to fix bootstrap multiselect search data using ajax

Laravel Passport - Not able to get token string in response?

Laravel passport auth token not working after moving to different server

How to solve Duplicate entry '0' for key 'PRIMARY' in Wordpress?

Laravel after login Two factor not working

PHP 8.1: strftime() is deprecated

Send Outlook 2010 email using PHP

About Contact Privacy policy Terms and conditions