【发布时间】:2014-09-11 10:40:55
【问题描述】:
我正在尝试使用 typeahed twitter 进行引导 https://github.com/twitter/typeahead.js
我需要根据用户输入的内容和另一个参数动态更改遥控器。 (目标是检索一个国家的城市)
尝试使用 country="en";不影响它 尝试使用 autocompleter.remote="..";不工作。
有什么想法吗?
<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>
【问题讨论】:
标签: twitter-bootstrap-3 typeahead.js twitter-typeahead