title: Search Data with AJAX in Laravel
body: <p>This is my ajax code. I want to type something in a textbox, and the result from database should show at the table.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    function retrieve(){
      var country = $('#country_name').val();
      $.ajax({
        type: "POST",
        url: '{{route('dataAjax-country')}}',
        data: {country:country},
        success: function(result){
          $('#ajaxtable').html(result);
        }
      });
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>But the data is not changing when I type on my textbox. I have a textbox and a table like this:</p>
  
  <pre><code>{!! Form::text('country_name', '', array('id'=&gt;'country_name', 'onkeyup'=&gt;'retrieve()')) !!}
  
  &lt;tbody id="ajaxtable"&gt;
    @foreach($results as $result)
      &lt;tr&gt;
        &lt;td&gt;{{$result-&gt;id}}&lt;/td&gt;
        &lt;td&gt;{{$result-&gt;country_name}}&lt;/td&gt;
      &lt;/tr&gt;
    @endforeach
  &lt;/tbody&gt;
  </code></pre>
  
  <p>And this is my route code, maybe I lack at my route?:</p>
  
  <pre><code>Route::get('asd', array(
          'as' =&gt; 'dataAjax-country', 'uses' =&gt; 'CompaniesController@dataAjaxCountry'));
  </code></pre>
  
  <p>And my controller that contain AJAX script that will show at the table:</p>
  
  <pre><code>public function dataAjaxCountry()
  {
      echo "&lt;tr&gt;&lt;td&gt;asdsad&lt;/td&gt;&lt;/tr&gt;";
  }
  </code></pre>