• 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

Exception thrown during the rendering of a template("Parameter "id" for route "url" must match "[^/]++" ("" given) to generate a corresponding URL.")

Do I need to install `fxp/composer-asset-plugin` if I'm not doing front-end development

Artisan, creating tables in database

Laravel 5.1 xmlHttpRequest AJAX POST TokenMismatchException

How to get variable from JavaScript to PHP [duplicate]

PHP | "The requested PHP extension bcmath is missing from your system."

array_map triple dimensional array [duplicate]

Sum column values from multiple arrays

SlimExceptionHttpNotFoundException

Laravel views are showing from cache on one server but works fine on other server

Laravel Unknown Column 'updated_at'

how to check version of codeigniter framework?

Too few arguments to function PendingResourceRegistration::name(),1 passed in C:xampphtdocsproject outesweb.php on line 18 and exactly 2 expected

How do I Post to .txt document before form submits

Transform array, set each array element with parent key php

About Contact Privacy policy Terms and conditions