• 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

User pool client {id}does not exist

How to load Codeigniter 4 lang file into an array variable

How to change the app environment at run time?

How to Generate PDF invoice to XML format using mPDF

Assets not referencing to public folder (Laravel)

Custom post type single page not working

file_put_content...fail to open stream:Permission denied in Laravel 5

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

Handling expired token in Laravel

PHPSpreadsheet - How Do I Use Auto Migration Tool

MySQL order by field in Eloquent

how to check version of codeigniter framework?

Custom Button next to “ADD TO CART” button of WooCommerce based on Product Type

Last order would be re-order in wooCommerce. How is it possible?

Add New Parameter to Existing URL using htaccess

About Contact Privacy policy Terms and conditions