I had this same problem when creating a todo feature with ajax and this is what I had to do to get it to work.
I added this to the head
<meta name="csrf-token" content="{{ csrf_token() }}">
I added this to the js file above the ajax request
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community