Program content related: Laravel+ajax+CSRF
Well, there are a lot of them that can be pulled out, and it seems to be a bit too small, just like the fiber on the mouse pad in front of me is not important, so I won't talk a lot of nonsense
Post your own solution, two lines of content
1. Add on the page
<meta name="csrf-token" content="{{ csrf_token() }}">
2. Then add it in the script tag of the page {{- This sentence is nonsense, but, ah, my blog is so short and I don't want to delete it - }}
$.ajaxSetup({headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}});
Perfect.
The above article Laravel solves the problem of 419 error - ajax request error (CSRF verification) is all the content I share with you. I hope you can give you a reference and I hope you can support me more.