jQuery UI Autocomplete with jsfiddle echo json
http://bugs.jqueryui.com/ticket/7230
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/base/jquery-ui.css">
<input id="autocomplete">
CSS
body{font:62.5% Verdana,Arial,sans-serif;}
JavaScript
$( "#autocomplete" ).autocomplete({
source: function( req, resp ) {
$.post( "/echo/json/", {
json: '["1", "2", "3", "4", "5"]',
delay: 1
}, function(data) {
resp( data );
}, "JSON" );
},
select: function( event, ui ) {
demo(ui.item.value);
}
});
function demo(value) {
alert(value);
}