[jQuery] [autocomplete] Data Array

[jQuery] [autocomplete] Data Array


Hello,
I am attempting to use the autocomplete plugin to allow users to pick
a text value from an input box and have the db id of that value
populated to a hidden field that can then be posted back to the
application. I have this working fine with a url data source, but am
confused how to do it with a JS array.
Here is what I have:
$("#suggest").autocomplete("/dev/autotest.php")
.result(function (evt, data, formatted) {
$("#sugghidden").val(data[1]);
});
Again, this works fine as autotest.php returns data in the format of:
Something|1
Another|2
Test|3
My question is in what way can I format the data if it is passed as an
array and still populate the hidden form?
Thanks.