Ajax lookup, with ghost completion
Send the typed query to a server endpoint and render the suggestions it returns.
The grey ghost letters drifting behind your typing are the
onHint callback — a best-match preview of what
pressing Tab would select.
Try — start typing a country
$('#country').devbridgeAutocomplete({
serviceUrl: '/api/countries',
onSelect: function (suggestion) {
// suggestion.value, suggestion.data
},
onHint: function (hint) {
// fill the ghost field behind the input
$('#country-ghost').val(hint);
},
});
Built in: query debounce, response caching, and bad-query suppression keep the network quiet.