VerifyCsrfToken example
Example 1: laravel meta csrf
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
Example 2: laravel add crf token form
<form action="{{ url('my-url') }}">
@csrf
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
<form action="{{ url('my-url') }}">
@csrf