• 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

Prestashop webservice API creating cart rules

how to validate form data in codeigniter 4

Display the WooCommerce product price inside a custom function

How to remove from a multidimensional array all duplicate elements including the original?

How to loop a tree array with unknown depth and get array blocks?

VichUploaderBundle error "Expected argument of type "File", "NULL" given" when submitting the form without selecting any file

Ajax GET request fails in laravel 8

Xdebug in Laravel is not working with VSCode

Laravel excel maatwebsite 3.1 import, date column in excel cell returns as unknown format number. How to solve this?

How to get AJAX to post on second page?

Match csv filenames to table names and import

Convert date and time to Jalali in Laravel

api response laravel doesn't show

The difference when using if statement true === something() vs something() === true [duplicate]

Only on Firefox "Loading failed for the <script> with source"

About Contact Privacy policy Terms and conditions