• 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

Login if user is active using Laravel Breeze

How to set dynamic `home` and `siteurl` in WordPress?

WordPress - Dynamically add user ID to the end of a URL

HTML + PHP + PHPMAILER

Filter WooCommerce products with post__in and additional meta queries

How can I stop a symfony process which is listening on http://127.0.0.1:8000

Image upload not working through ajax Laravel

Get sum of arrays inside array

PHP echo values of all sub keys [duplicate]

How to fix 'Data has already been sent to output, unable to output PDF file' in MPDF

Testing subscription renewals on Stripe

Sliders in Laravel

JSON Render Issue in Date Object Laravel and PHP 7.4

How do I get friend list from Friends table with counts of friends of my friends

How to update array value in Laravel

About Contact Privacy policy Terms and conditions