Вот код jQuery: -
Код: Выделить всё
$(function() {
function log( message ) {
$( "" ).text( message ).prependTo( "#log" );
$( "#log" ).scrollTop( 0 );
}
$( "#birds" ).autocomplete({
source: "search.php",
minLength: 2,
select: function( event, ui ) {
log( ui.item ? "Selected: " + ui.item.actor + " aka " + ui.item.label :
"Nothing selected, input was " + this.actor );
// window.location.href = 'pretravel.php?id=' + ui.item.label;
// document.testForm.action = "pretravel.php?id="+ui.item.value;
//document.testForm.submit();
}
});
});
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/21757047/jquery-autocomplete-displays-id-instead-of-name[/url]
Мобильная версия