I am using jquery ui auto complete but when i am trying to get the value from simple javascript variable i am getting but jquery Ui auto complete is not working with the php mysql file this is my code
<div class="col-md-12" class="col-centered">
<input id="tags" type="text" class="dic_input ui-autocomplete-input" data-provide="tags" name="ajaxData"/>
<button class="btn btn-lg btn-default"><i class="fa fa-2x fa-search"></i></button>
</div>
this is my javascript code
$(function()
{ var availableTags = [
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$("#tags").autocomplete({
source: "auto.php",
minLength: 1
});
});
this is my php code
$db=mysql_connect("localhost","root","");
mysql_select_db("hifzil");
$searchTerm = $_GET['term'];
//get matched data from skills table
$sql ="SELECT lemma FROM lemma WHERE lemma like '" . $searchTerm . "%' ORDER BY lemma LIMIT 0,6";
$q=mysql_query($sql);
while ($row = mysql_fetch_array($q)) {
$data[] = str_replace("-"," ",$row['lemma']);
}
//return json data
echo json_encode($data);