Вот что я сделал, у меня есть json на моем бэкэнде для этого примера (возможно, для html по умолчанию его можно немного подправить :), но вся идея должна быть примерно такой же
$('#search').autocomplete({
source: function(request, response) {
var requestUrl = 'search.php';
requestUrl += '?term=' + $('#search').val();
$.getJSON(requestUrl, request, function(data){
// I know here - what kind of array of json objects I'll get as
// a result, with <li> elements it should be even easier (I guess)
// AND: this will add item, if there are more than 5 elms in the list,
// but you should get the idea
if (5 < data.length) {
data.push({
id: -1,
value: '',
label: 'Put your own question...'
});
}
response(data);
});
}
});