• 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

disable two buttons after clicking another button

Appending data to an anchor tag

how do i retrieve and display the alt text of an image in wordpress?

VB.NET WebRequest with PHP POST

Add 2 Webcam in one page with WebcamJS

No definition found for function in vendor vscode

Unit (real unit test) of test laravel relationship

JQuery content editable div and text box on submit not sending POST

Insert database rows from columns of data from associative array of indexed arrays

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

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

Laravel update hasMany relationship using saveMany

Input and output values for php into the browser?

Wordpress 'post_type_link' hides permalink

array_key_exists(): The first argument should be either a string or an integer

About Contact Privacy policy Terms and conditions