• 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

Call to a member function fetch_field() on a non-object MySQLiDB

curl returning 301 error after migrating to https

How to insert data from multiple select dropdown values into database?

get attribute from class not working php 7

SQL AVG() to 2 decimals

Get orders by date and status woocommerce

PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: no such host known

Laravel-fopen: failed to open stream: Permission denied

How can I get a div content in php

Split array into 4-element chunks then implode into strings

Can't call javascript alert alertify library from PHP

Split comma separated value from table column into rows using mysql?

Facebook SDK error: Cross-site request forgery validation failed. Required param "state" missing from persistent data

Lexik JWT authentication problem "Invalid credentials"

401 Unauthorized only occurring on some pages in Laravel 8

About Contact Privacy policy Terms and conditions