Im currently using This JQuery as a search box on my website. The Javascript currently calls in values from a .txt file for the autocomplete results. However as I want my site to eventually have the option of the user adding these values, I'd like It to call in values from my database table instead.
JQuery on index page that calls the .txt file:
$(document).ready(function(){
$("#select3").fcbkcomplete({
json_url: "data.txt",
addontab: true,
maxitems: 10,
input_min_size: 0,
height: 10,
cache: true,
newel: true,
select_all_text: "select",
});
});
Formatting of the .txt file:
[{"key": "hello world", "value": "hello world"}, {"key": "movies", "value": "movies"},
I thought the solution would be instead of calling data.txt, to call data.php and have this code pull in values:
$getData = mysql_query("SELECT Name FROM tblCocktails");
while($info = mysql_fetch_array($getData))
{
echo "key: value:".$item['Name']"key: value:".$item['Name']';
}
however this doesn't seem to work and my debugging on dreamweaver has decided to not work. Any help would be appreciated.