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