Create confirm button with Sweetalert, Javascript and Laravel
<p>Html:</p>

<pre><code>&lt;form id="myform" class="delete-photo col-md-12" method="POST" action="/admin/category/{{$catget-&gt;id}}"&gt;
        &lt;input type="hidden" name="_method" value="delete"&gt;                    
            {{ csrf_field() }}                            
            &lt;div class="form-group"&gt;
                &lt;button type="submit" data-photo-id="{{$catget-&gt;id}}"
                class="submitdel btn btn-danger"
                &gt;Delete Category&lt;/button&gt;
            &lt;/div&gt;                    
    &lt;/form&gt;
</code></pre>

<p>Js:</p>

<pre><code>&lt;script type="text/javascript"&gt;
 $('.delete-photo').click(function(e) {
   e.preventDefault(); // Prevent the href from redirecting directly
   var linkURL = $(this).attr("action");
   warnBeforeRedirect(linkURL);
 });

 function warnBeforeRedirect(linkURL) {
   swal({
     title: "Leave this site?", 
     text: "If you click 'OK', you will be redirected to " + linkURL, 
     type: "warning",
     showCancelButton: true
   }, function() {
     // Redirect the user
     window.location.href = linkURL;
   });
 }
&lt;/script&gt;
</code></pre>

<p>I am trying to create a confirmation button with sweetalert. I tryed to redirect to correct route which is (<a href="http://localhost:8000/admin/category/13" rel="nofollow">http://localhost:8000/admin/category/13</a>) but the laravel says:</p>

<blockquote>
  <p>MethodNotAllowedHttpException in RouteCollection.php line 219:....</p>
</blockquote>

<p>My route is:</p>

<pre><code>Route::delete('/admin/category/{id}', 'adminpanel@deletecategory');
</code></pre>

<p>What can be possible wrong or fix that issue?</p>