I am using jQuery’s autocomplete function to fetch possible input labeles/values from suggest_address.php.
It looks like this:

Normally suggest_address.php returns an associative array of label and value .
But since suggest_address.php determines whether the input is of type “zip” or type “city”, I return an additional key/value pair: “type” :”city” or “type” : “zip”.
I want to store this value as an attribute in the input box so that it could it could be used in later queries.
How do I do this?
I know the source parameter for the autocomplete function could be a function that receives request, and response, but how do I get the response from it without modifying the source?
Right now my initialization looks like this:
$('#addresssearch').autocomplete({
source: 'suggest_address.php',
minLength: 2
});
Your data object for each response can include any other key/value pairs you want. They then get included in the
uiargument of event handlers.For exeample
For a jQueryUI live demo example clcik on “View Source” in following API demo:
http://jqueryui.com/autocomplete/#custom-data