[jQuery] autocomplete
[jQuery] autocomplete
Hi all new to the group and jQuery in general.
I just installed the very cool autocomplete plugin yesterday and have
it working in the following scenarios:
$("#example").autocomplete(data);
Where data is a local string as shown in the examples.
$("#example").autocomplete('get_data.php');
Where the data is retrieved from a PHP page that calls a mysql
database.
Now I am trying to get it to work inside of an app built in CakePHP. I
have data as a JSON object with the following structure:
var data = {"0000000017":"angel hair","0000000016":"basmati
rice","0000000021":"black beans"}
I thought that I could just pass this to autocomplete but nothing
happens. Meaning the autocomplete field does do anything at all on the
UI.
My question is: what is the correct way to handle a JSON object with
autocomplete? Do I need to enumerate the values into a string? That
seems a little hacky. Just looking for the correct methodology.
Thanks.