• 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 change product Image when variables are selected in Shop and Archive Pages?

How to display MySQL table using php and edit it in a web browser

Get WooCommerce products from specific category

SMTP "Error: DATA not accepted from server!" Opencart 2.3 on InMotionHosting

PHP using str_starts_with for array to exclude same as with wildcard

How to update array value in Laravel

How to to send mail using gmail in Laravel?

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

Parsing JSON File to array in PHP

Target Laravelista is not instantiable

PHP password_verify

How to get median and quartiles/percentiles of an array in JavaScript (or PHP)?

How to test a php login connected to a mysql db through xampp?

Laravel: Why is my variable not being set while it's in the construct function of the controller?

php code to send checkbox form results to email

About Contact Privacy policy Terms and conditions