• 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 get the total hour from starting time to end time in php

Adding Multiple Custom Post Types in Wordpress

Using spatie/media-library, how to rename a collection of uploaded files?

How to pass security cloudflare server with php curl

Reducing authentication calls on external API (Laravel 5.6)

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

What is PHP's equivalent of JavaScript's "array.every()"?

CodeIgniter extend CI_URI undefined method

php curl requesting twice

Return new collection without modifying original collection

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

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

PHP: set a (deep) array key from an array [closed]

How to put php code inside opening and closing shortcodes

Jquery DataTables: Data not displaying in table via Ajax

About Contact Privacy policy Terms and conditions