My route:
Route::get('deleterequest/{request_id}', 'RequestController@getDeleteRequest')->name('getDeleteRequest');
In view, i want to click a tag to call this route View:
<a onclick=" confirmDelete({{ $request->task_id }})" href="#" ><span class="fa fa-trash-o"></span></a>
<script type="text/javascript">
function confirmDelete(id){
document.location.href="{!! route('getDeleteRequest', $id); !!}";
}
when i run the code, it show error message:
Undefined variable: id