2👍
✅
It should be _token
instead of csrf
.
data: {
mensaje: '',
pedidos: [],
"_token": document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
},
Also instead of getting token from a query selector you can achive it like this too.
data: {
"_token":{{ csrf_token() }}
},
Source:stackexchange.com