I am trying to use typeahed twitter for bootstrap https://github.com/twitter/typeahead.js
I need to change the remote dynamically according to what user types in and ANOTHER parameter. (The goal is to retrieve the cities of a country)
trying with country="en"; does not affect it trying with autocompleter.remote=".."; does not work.
Any idea ?
<script>
var country="fr";
var autocompleter = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: 'ajax.php?action=getVilles&country='+country+'&ville=%QUERY'
});
autocompleter.initialize();
$('#city').typeahead(null, {
name: 'city',
displayKey: 'city',
source: autocompleter.ttAdapter()
});
</script>