<script>
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy"
];
$( "#fname" ).autocomplete({
source: availableTags
});
});
The above function helps me to achieve auto complete using static values, what I want is to get these values from the database. I wrote a php function that connect to the db but I am not sure how to pass the return value of that function to the javascript page below is snippet of that.
function getAllDrugs(){
$med = "";
$select = mysql_query("SELECT dname FROM phar_store_config where quantity > 1");
while($row = mysql_fetch_array($select)){
$med = $med.$row['dname'];
}
return $med;
}
Now i want the return value of the above php function to be passed to my js function.
Any help will be appreciated.