• 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

Laravel Delete and Update

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

Doctrine 2 mapping referencing unique key

Navigation idle on content download

how to loop through json response data using ajax jquery?

Sentry on Symfony: how to exclude `NotFoundHttpException`

protect my blog content

How to get total pages of PDF with FPDF?

PHPExcel file download using AJAX call

PHP SoapClient: set a namespace without prefix

Laravel Factory not calling callback 'afterCreating'

Why the name of trucks are same in 2nd and 3rd record of company data retrieval?

How to connect to MSSQL Server with PHP from Ubuntu 18.04?

Uploading video to Youtube using Youtube Data API V3 and Google API Client PHP -- getting 401 (unauthorized) message

ldap is missing from system when installing adldap2 in laravel

About Contact Privacy policy Terms and conditions