i'm using ajax with laravel for the first time and i have an error, it gives me status 500 Internal Server Error back.. Im sending the token and everything seems to be ok, can you guys check and maybe see where the problem is :), thanks a lot.
Code:
jQuery(document).ready(function () {
jQuery('#ajaxSubmit').click(function (e) {
e.preventDefault();
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
}
});
console.log(listvalues)
jQuery.ajax({
url: "{{ route('downloadSelectedCsv') }}",
method: 'POST',
data: {
ids: listvalues,
},
});
});
});
Route: (Web.php)
Route::post('/download/csv', [\App\Http\Controllers\UrlController::class, 'downloadSelected'])->middleware(['auth'])->name('downloadSelectedCsv');
Santiago Trujillo