• 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

Display a product custom field only in WooCommerce Admin single orders

best way to store error messages in Laravel (session or variable)

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

Get all WooCommerce products within own plugin

nginx err_connection_refused, can anyone help me?

PHP how to detect if running on arm64 cpu?

How to remove Deprecated SymfonyComponentDebugDebugClassLoader?

Sort multidimensional array by column value within a column

Ajax GET request fails in laravel 8

No result using makeStyles Material UI in react 18

Which is faster php date functions or carbon?

PHP web3 ERC20 token function call

Laravel Unresolvable dependency resolving [Parameter #0 [ <required> $method ]] in class GuzzleHttpPsr7Request

How to change HTML structure inside WP <head>

How to loop sql table data inside a html table

About Contact Privacy policy Terms and conditions