I have this function for my delete button
<a href="#" onclick='deleteFile("{{ ($event->id) }}", "{{ ($file->name) }}")' class="btn btn-danger btn-xs delete">Löschen</a>
and the route in routes/web.php
Route::post('/delete-file', 'MyController@deleteEventFile');
that hits this function
public function deleteEventFile($eventid, $filename){
dd($eventid);
}
and this is my ajax function:
function deleteFile(eventid, filename){
//alert(filename);
//alert(eventid);
$.ajax({
url: '/delete-file/',
type: "post",
data:{ _token: "{{csrf_token()}}", eventid: eventid, filename: filename },
dataType: 'json',
});
}
And i always get this error:
Missing argument 1 for App\Http\Controllers\MyController::deleteEventFile()
my variables can't get through... How to pass the eventid and filename to controller