I am using jquery-ui in this snippet:
$(document).ready(function () {
$(function() {
function log( message ) {
$( "<div>" ).text( message ).prependTo( "#log" );
$( "#log" ).scrollTop( 0 );
}
});
$( "#birds" ).autocomplete({
source: "search.php",
minLength: 4,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.value + " aka " + ui.item.id :
"Nothing selected, input was " + this.value );
}
});
});
<div class="ui-widget">
<label for="birds">Birds: </label>
<input id="birds">
</div>
<div class="ui-widget" style="margin-top:2em; font-family:Arial">
Result:
<div id="log" style="height: 200px; width: 300px; overflow: auto;" class="ui-widget-content">
</div>
/div>
and my search.php:
$myarray = ["somelabelvalue","somelabelvalue1","somelabelvalue2","somelabelvalue3"];
echo json_encode($myarray);
BUT when i type: "oems" => every option of the array appear´s! why? It should appear only if i type "some". So where is my mistake in search.php?
this one works correctly: http://jqueryui.com/autocomplete/#remote ..
Greetings!