PHP Laravel : Delete Data using Ajax
<p>I want to delete some data from database using ajax.. I've done the following steps to run..But while I was trying to delete it's shows following Error:</p>

<blockquote>
  <p>Failed to load resource: the server responded with a status of 404
  (Not Found)</p>
</blockquote>

<p>Here is my route:</p>

<pre><code>Route::post('/delete/{id}',[
    'uses'=&gt;'ItemController@delete',
    'as' =&gt; 'delete'
    ]);
</code></pre>

<p>Here is the controller:</p>

<pre><code>public function delete($id)
        {
           Item::find($id)-&gt;delete();
            return Redirect::back();            
        }   
</code></pre>

<p>And here is my view page:</p>

<pre><code>&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt; Item List&lt;/title&gt;
        &lt;meta name="csrf-token" content="{{ csrf_token() }}"&gt;
        &lt;link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.css"&gt;
        &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
    &lt;/head&gt;

    &lt;body&gt;
            &lt;div class="container"&gt;
                &lt;h3&gt; List Of Courses &lt;/h3&gt;&lt;/br&gt;

                &lt;table class="table table-striped table-bordered dataTable" id="example"&gt;
                &lt;thead&gt;
                &lt;tr&gt;
                    &lt;td&gt;Serial No&lt;/td&gt;
                    &lt;td&gt;Title&lt;/td&gt;
                    &lt;td&gt;Description&lt;/td&gt;                    
                    &lt;td&gt;Action&lt;/td&gt;
                &lt;/tr&gt;
                &lt;/thead&gt;
                &lt;tbody&gt;
                &lt;?php $i=1; ?&gt;
                @foreach($items as $row)

                    &lt;tr&gt;
                        &lt;td&gt;{{$i}}&lt;/td&gt;
                        &lt;td&gt;{{$row-&gt;title }}&lt;/td&gt;
                        &lt;td&gt;{{$row-&gt;description}}&lt;/td&gt;                      
                        &lt;td&gt;    
                            &lt;button type="button" onclick="deleteItem({{ $row-&gt;id }})" id="Reco" class="btn btn-danger"&gt;Delete&lt;/button&gt;         
                        &lt;/td&gt;
                    &lt;/tr&gt;

                &lt;?php $i++; ?&gt;

                @endforeach
                &lt;/tbody&gt;
            &lt;/table&gt;
            &lt;/div&gt;

            &lt;script&gt;
            function deleteItem(id) {
                $.ajaxSetup({
                        headers: {
                      'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    }
             });
          $.ajax({ 
                    type: "POST", 
                    url: '/delete/'+id,               

                    success: function(result) {
                          console.log(result);
                        }
                });          
            }
            &lt;/script&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>If anyone find the error I've done, hope you'll help me to find it out.</p>