I am trying to do create text-box auto-complete with jquery. But something goes wrong when I check it in debuger it shows the every value but it not showing in text-box drop-down on view page. I'm newbie all help would be appreciated.
here's my view code.
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script type="text/javascript">
$(function(){
$("#location").autocomplete({
source: 'set_location'
});
});
</script>
<form action= "#">
<table>
<tr>
<td><label for='location'>Location</label></td>
<td><input id="location" type="text" size="50" placeholder="Enter a location" name= "location"> </td>
</tr>
</table>
</form>
here's my controller code
if(isset($_GET['term'])){
$location = strtolower($_GET['term']);
$query = $this->venues_model->set_location($location);
echo $query;
}
here's my model code
$this->db->select('*');
$this->db->like('location', $location);
$query = $this->db->get('venue_details');
if(count($query->result_array()) > 0){
foreach ($query->result_array() as $row){
$row_set[] = htmlentities(stripslashes($row['location']));
}
echo json_encode($row_set);
}
