I have an autocomplete snippet which retrieve’s City names based on your search term.
For example the search term s would print:

So if I would use:
var f = [];
$.each(a.RESULTS, function (a, b) {
f.push(b.name /* + b.zmw */)
});
b(f)
I would get printed the name of every city.
Live Example: http://jsfiddle.net/muWah/18/
How could I print/console.log() the zmw value of each city whenever I click on it.
So when I click on Serbia, I should get printed 000RB.1.99999
You can push a new object, with a label and value.
Label is what’s picked up for auto-complete, and value is what appears in the input when selected.
DEMO: http://jsfiddle.net/muWah/21/
If you wanted to just have the
zmwreference in the console, rather than printed out in the input, you can add more properties to the object you passed through. For example:Then
b.item.zmwwould be what you’d print out in your console, but the name/value would still be"Serbia"(or whatever you click on)DEMO: http://jsfiddle.net/muWah/24/