Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
typeahead
$('.typeahead').typeahead({
hint: true,
highlight: true,
minLength: 3
}, {
async: true,
displayKey: 'name',
source: function (query, processSync, processAsync) {
processSync(actorMatcher(query, JSON.parse($('.typeahead').attr('data-suggestions'))));
return $.ajax({
url: "/actors/active",
type: 'GET',
data: { query: query },
dataType: 'json',
success: function (json) {
return processAsync(json);
}
});
}
}).on('typeahead:selected', function(event, data){
$('.actor-id').val(data.id);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment