• 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 connect to MSSQL Server with PHP from Ubuntu 18.04?

PHP usort() order in case of equality

How to convert binary string to normal string in php

Autoloading classes in PHPUnit using Composer and autoload.php

Appending data to an anchor tag

Combine multiple columns into an array as one of the key in a results set

Live search query using JS and PHP for QA forum

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

Inserting Country Selection into MySQL PHP [duplicate]

Add restriction to WooCommerce coupons by allowed user ID

PHPUnit gives error: Target [IlluminateContractsViewFactory] is not instantiable

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null

Adding the custom page with add_menu_page function on Wordpress

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

PHP Fatal error: Class not found - PHPUnit

About Contact Privacy policy Terms and conditions