I'm using typeahead with Bloodhound and I need to get the caller element id from Bloodhound. This is the code:
var destinations = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '/json/cities/1',
remote: {
url: "/json/cities/%COUNTRY/%QUERY",
replace: function (url, uriEncodedQuery) {
return url.replace('%QUERY', uriEncodedQuery).replace('%COUNTRY', $('#country_1').val());
},
},
limit: 30
});
destinations.initialize();
as you can see, just for example, I replace %COUNTRY with $('#country_1').val()
but I need the caller id, getting the index and than get the correct country_id. $('#country_+caller.getPartOfId()).val()
is this possibile?