• 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

Distribute array row data to make multiple new rows

Getting error: CodeIgniterDatabaseBaseResult::getResult in CodeIgniter

Laravel MSSQL Server Connection not working

laravel MVC execution flow

How to get array values using foreach in laravel

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

Laravel after login Two factor not working

sort() not affecting original array while inside foreach loop

PHP function Not Working As Expected From functions.php Include File

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null

How to Display Data in Yajra Datatables Laravel 7?

str_replace or preg_replace random number from string

Auto increment id JSON

Elasticsearch - Want to sort by field in all indices where that particular field available or not if not then avoid it

About Contact Privacy policy Terms and conditions