Is there a way to make it work an ajax request with header X-XSRF-TOKEN
?
$.ajax({
type: "POST",
headers: { 'X-XSRF-TOKEN': token },
url: '/edit_preset_filters',
data: data,
success: function (result) {
$('#errorSaveFilter').hide();
$('#save-filters').dialog('close');
}
});
Error message
message "CSRF token mismatch." exception "Symfony\Component\HttpKernel\Exception\HttpException"
This way I get the token
<?php
$encrypter = app('Illuminate\Encryption\Encrypter');
$encrypted_token = $encrypter->encrypt(csrf_token());
<input id="token" type="hidden" value="{{$encrypted_token}}">