• 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

PHP array_filter with arguments

PHP SoapClient: set a namespace without prefix

If you intend you use SMTP, add your SMTP Code after this Line

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

Get image type from base64 encoded src string

Add a custom text for a particular product on specific email notification in Woocommerce

hidden INPUT value not available in $_POST

LARAVEL: How to fetch id dynamically in a query builder?

Creating a config file in PHP

Implode array with array of glue strings

Nginx RTMP not recording

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

Symfony 4: how to allow dynamic values for array nodes in bundle configuration?

Need to display only array value in JSON output

PHP - CURL using HTTPS [closed]

About Contact Privacy policy Terms and conditions