I am trying to implement Jquery Autocomplete. I'm using the tutorial example from their site but so far it is returning all of my results regardless of what I enter for the search
<script>
$(function() {
$( "#birds" ).autocomplete({
source: "fetchData.php",
minLength: 2,
select: function( event, ui ) {
log( "Selected: " + ui.item.value + " aka " + ui.item.id );
}
});
});
fetchData.php
$conn = new PDO ('odbc:xxx','xxxx','xxxxxx');
$qry = "select distinct name_customer from v_customer_master";
$sql = $conn->query($qry);
//$custName = array();
while($row = $sql->fetch((PDO::FETCH_ASSOC))){
$row['name_customer'] = mb_convert_encoding($row['name_customer'], 'UTF-8', 'UTF-8');
$custName[] = $row['name_customer'];
//array_push($custName,$row['name_customer']);
}
echo json_encode($custName);