In your HTML head
<meta name="csrf-token" content="{{ csrf_token() }}">
And your jQuery :
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
Summer Sale! All accounts are 50% off this week.
I'm adding an imageuploader to my form.
I'm using the dropzoneJS to send the image via Ajax.
But nothing is really happening, the ajax post is not working and is returning to me:
TokenMismatchException
I'm guessing the Ajax is not sending the CSRF, how can I fix this??
The class sends it automatically through their JS function.
I have to add CSRF token somewhere... and some how??
In your HTML head
<meta name="csrf-token" content="{{ csrf_token() }}">
And your jQuery :
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
Please or to participate in this conversation.