Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Пример подключения подсказок DaData для typeahead.js
var address = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote :{
url: '',
replace: function(url,q){ = '{ "query": "' + q + '" }';
return url + '?q=' + q;
filter: function(resp){
return resp.suggestions;
ajax: {
type: 'POST',
dataType: 'json',
headers: {
'Authorization': 'Token REPLACE_WITH_API_KEY',
'Content-Type': 'application/json'
$('#remote .typeahead').typeahead(null, {
name: 'address',
displayKey: 'value',
source: address.ttAdapter()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.