• 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 make a foreign key not using primary key

java URL working on browser but not in client program

Fatal error: Uncaught mysqli_sql_exception: Unknown database 'test' in ... (How do I fix that? Using PHP)

laravel automatically deletes server.php on php artisan serve

Create tags in laravel post publishing

Auto increment id JSON

Class AppHttpControllersUserController Does Not Exist

TesseractOCR not working for Laravel

Submitting a form with ajax in Wordpress

How to get company posts from LinkedIn via API?

PHP -> Next nearest date defined by array of days in week

Limit of log line written to Apache Errorlog from mod php error_log

Laravel Passport - Not able to get token string in response?

protect my blog content

how to create html table in php

About Contact Privacy policy Terms and conditions