i tried many times to post an ajax request with axios using vuejs to lararvel app i added the csrf_token() in meta master blade. but the status always returns as 419 (Unknown Status), If some has got similar type of error then please help.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
You must assign value of
csrf_token()
to some field in your layout file. I would suggest you use like this:If you are using Laravel mix to compile your JS & CSS, then the csrf_token is automatically added to the axios configuration. Following is the code in
resources/assets/js/bootstrap.js
for axios configuration whenever you create a Laravel application.For above to work automatically, you need to run
npm install
oryarn install
if you have installed yarn.