title: Laravel:Failed to load resource
body: <p>Hey i am new at laravel and i am making an autocomplete search bar. But i am having problem that is when i write any word it gives error in my console panel that is </p>
  
  <pre><code>     Failed to load resource: the server responded with a status of 404 (Not Found).
  </code></pre>
  
  <p>Controller of my code is given below</p>
  
  <pre><code>     &lt;?php
        namespace App\Http\Controllers;
  
  
        use Illuminate\Http\Request;
        use App\Disease;
        use Input;
  
      class DiseaseController extends Controller
        {
         public function index()
        {
              return view('disease.disease');
         }
       public function autocomplete(Request $request)
       {
          $term = $request-&gt;term;
            $data = Disease::where('symtomps','Like','%'.$term.'%')
          -&gt;take(2)
          -&gt;get();
          $result=array();
  
        foreach($data as $key =&gt; $v)
      {
          $results[]=['id' =&gt;$v-&gt;id,'value'=&gt;$v-&gt;symtomps];
      }
      return response()-&gt;json($results);
      }
   }
  </code></pre>
  
  <p>View of my code is</p>
  
  <pre><code>              &lt;html&gt;
         &lt;head&gt;
           &lt;link rel="stylesheet" 
              href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-
              beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"&gt;
  &lt;link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"&gt;
  &lt;script src="//code.jquery.com/jquery-1.10.2.js"&gt;&lt;/script&gt;
  &lt;script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
    &lt;body&gt;
  &lt;div class="row"&gt;
      &lt;div class="col-md-4"&gt;&lt;/div&gt;
     &lt;div class="col col-md-4"&gt;
        &lt;section class="card"&gt;
           &lt;header class="card-heading"&gt;
               &lt;input type="text" name="searchname" class="form-control" id="searchname" placeholder="Search"  &gt;
            &lt;/header&gt;
            &lt;div class="card-block"&gt;
              &lt;table&gt;
                  &lt;tr&gt;
                    &lt;td&gt;ID&lt;/td&gt;
                    &lt;td&gt;&lt;input type="text" name="id" class="form-control"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                  &lt;td&gt;Symtomps&lt;/td&gt;
                    &lt;td&gt;&lt;input type="text" name="symtomps" class="form-control" &gt;&lt;/td&gt;
                  &lt;/tr&gt;
                &lt;/table&gt;
  
            &lt;/div&gt;
         &lt;/section&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
     &lt;script type="text/javascript"&gt;
  $('#searchname').autocomplete({
      source: '{!!URL::route('autocomplete')!!}',
      minlength:1,
      autoFocus:true,
      select:function(e,ui){
      $('#id').val(ui.item.id);
  }
  });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>
  And route is</p>
  
  <pre><code>Route::get('/',array('as'=&gt;'disease','uses'=&gt;'DiseaseController@index'));
    Route::get('/autocomplete',array('as'=&gt;'autocomplete',
    'uses'=&gt;'DiseaseController@autocomplete'));
  </code></pre>
  
  <p>Please help me where i am doing wrong as its not showing me any data when i type any word it just show the error in the console.</p>