title: Autocomplete jQuery from MySQL not working
body: <p>I am working on a Laravel view page and getting data from a DB using jQuery. I have other functions working fine but I am not able to see what I am doing wrong here. It returns an empty field.</p>
  <p>I am enclosing code snippets for blade, controller, <code>web.php</code>, <code>default.js</code>.</p>
  <p>Help me please :)</p>
  <pre class="lang-js prettyprint-override"><code>/* default.js*/
  $( &quot;.search_doc_name&quot; ).autocomplete({
    source: &quot;/search/doc_name&quot;,
    minLength: 1,
    response: function(event, ui) {
      if (ui.content.length === 0) {
        $(this).parent().addClass('has-error');
        $(this).next().removeClass('glyphicon-ok').addClass('glyphicon-remove');
  
        $(&quot;.search_doc_name_empty&quot;).show();
        $('.form_submit').hide();
      } else {
        $(&quot;.search_doc_name_empty&quot;).hide();
        $('.form_submit').show();
      }
    },
    select: function(event, ui) {
      $('.search_doc_id').val(ui.item.id);
      $('.search_doc_name').val(ui.item.value);
    }
  });
  
  $( &quot;.search_doc_name&quot; ).on('keyup',function(){
     $(&quot;.search_doc_name_empty&quot;).hide();
  });
  </code></pre>
  <pre class="lang-php prettyprint-override"><code>/*And this is my controller :*/
  public function doc_name(Request $request){
    $term = $request['term'];
    $input = $request-&gt;all();
  
    $results = array();
  
    $queries = \App\Models\DoctorsDetail::where('doc_name', 'LIKE', '%'.$term.'%')-&gt;take(25)-&gt;get();
  
    foreach ($queries as $key =&gt; $value)
      {
         $queries[$key]['value'] = $value-&gt;doc_name;
      }
  
      return \Response::json($queries);
  }
  </code></pre>
  <pre class="lang-php prettyprint-override"><code>/* web.php*/
  Route::group(['prefix' =&gt; 'search'], function () {
    Route::any('/doc_name', 'SearchController@doc_name');
  });
  </code></pre>
  <pre><code>/*blade*/
    &lt;div class=&quot;col-sm-6&quot;&gt;
      &lt;div class=&quot;form-group&quot;&gt;
        &lt;label&gt;اسم الدكتور&lt;/label&gt;&lt;br&gt;
        &lt;input type=&quot;text&quot; class=&quot;form-control search_doc_name&quot;  placeholder=&quot;Type here ...&quot; name=&quot;doc_name&quot;&gt;
        &lt;span class=&quot;help-block search_doc_name_empty&quot; style=&quot;display: none;&quot;&gt;No Results Found ...&lt;/span&gt;
        &lt;input type=&quot;hidden&quot; class=&quot;search_doc_id&quot; name=&quot;doc_id&quot;&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>