• 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 get company posts from LinkedIn via API?

how to fix Service provider class not found when using repository?

how to get value from array in laravel

nginx err_connection_refused, can anyone help me?

Why i get wrong output for html markdown?

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

Clients authentication and user authentication with laravel

Error Class "LaravelFortifyFeatures" not found

Do I need to install `fxp/composer-asset-plugin` if I'm not doing front-end development

Phalcon: setStatusCode returns empty response

Image upload not working through ajax Laravel

hidden INPUT value not available in $_POST

"cannot list resources" error from WooCommerce REST API

Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetch_assoc() [duplicate]

PHP using str_starts_with for array to exclude same as with wildcard

About Contact Privacy policy Terms and conditions