ironkiss,
var zip = [];
$( "#ab" ).autocomplete({
source: function( request, response ) {
$.ajax({
url: "source/sugg.php",
dataType: "jsonp",
data: {
max: "7",
term: request.term
},
autoFocus: true,
success: function( data ) {
response( data );
}
});
},
response: function( event, ui ) {
zip = ui.content.map(function(el) {
return el.city + " (" + el.iata + ")"
})},
close: function( event, ui ) {
var value = this.value;
if(zip.length && zip.indexOf(value) == -1) this.value = zip[0]
},
minLength: 3,
select: