• 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

Get keys from associative array [duplicate]

merging two arrays with specified index

how to loop through json response data using ajax jquery?

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

How to Make Laravel Eloquent "IN" Query?

Install mysql client in docker image

Laravel print last executed SQL query with Query log

Return new collection without modifying original collection

Laravel 5 issue with wherePivot

Laravel display validation error

Laravel Route issues with Route order in web.php

unable to load your default controller on Codeigniter

add_action() function in wordpress not working [duplicate]

How to get monthly wise data in laravel

Having trouble with PDO queries (Notice: Undefined index)

About Contact Privacy policy Terms and conditions