Get value in jquery autocomplete
$("input#shopName").autocomplete({
source: "getShop.php",
minLength: 2,
select: function(event, ui) {
$("#theHidden").val(ui.item.id)
}
});
See http://jqueryui.com/demos/autocomplete/#event-select