I've done some research and followed a tutorial exactly, with minor changes, but I can't seem to get this to work. No dropdown appears. Can you look at the code and tell me what is not happening?
<div class="ui-widget">
<label for="skills">Skills: </label>
<input id="skills">
</div>
<script>
$(function() {
$( "#skills" ).autocomplete({
width:448,
delimiter: /(,|;)\s*/,
lookup: <?php echo "'autocomplete(#skills)'" ?>
});
});
</script>
<?php
$servername = 'localhost';
$username = 'xx';
$password = 'xx';
$con = mysql_connect($servername,$username,$password);
mysql_select_db('c9', $con);
function autocomplete($inputName){
$searchTerm = $_GET[$inputName];
$query = mysql_query("SELECT * FROM clients WHERE fname LIKE '%".$searchTerm."%' ORDER BY fname ASC");
while ($row = mysql_fetch_array(MYSQL_ASSOC)) {
$data[] = $row['fname'];
}
//return json data
echo json_encode($data);
}
?>