title: codeigniter not returning data from database based on where condition
body: <p>i am trying to get get some data through an ajax call in codeigniter based on the user input but i keep getting all result from the database instead of the matching ones.</p>
  
  <p>here is my ajax:</p>
  
  <pre><code>$(document).ready(function () {
      $(".filter").keyup(function () {
          var keyword= $("#loc").val();
          $.ajax({
              type: "POST",
              url: CFG.url + '/pages/filter_hotel_by_loc/',
              data: keyword,
              dataType: "json",
              success: function (data) {
                  console.log(data);
              }
          });
  });
  });
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>    public function hotel_by_location($keyword){
          $this-&gt;db-&gt;like("location", $keyword);
          $query = $this-&gt;db-&gt;get('hotels');
          return $query-&gt;result_array();
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>    public function filter_hotel_by_loc(){
      $keyword=$this-&gt;input-&gt;post('loc');
      $data=$this-&gt;page_model-&gt;hotel_by_location($keyword);        
      echo json_encode($data);
  </code></pre>
  
  <p>View: </p>
  
  <pre><code>&lt;div class="input-style-1 b-50 color-3"&gt;
  &lt;?php echo form_open_multipart('hotels/filter_hotel_by_loc') ?&gt;
  &lt;img src="&lt;?php echo base_url();?&gt;assets/img/loc_icon_small_grey.png"alt=""&gt;
  &lt;input type="text" name="loc" placeholder="What city do you prefer?"id="loca" class="filter"&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Please what am i doing wrong?</p>