【发布时间】:2013-12-21 22:56:32
【问题描述】:
我正在使用 twitter bootstrap typeahead,并且我有这两个 java 脚本函数来初始化自动完成
function autocomplete1(phr_type) {
$('.typeahead').typeahead({
name: 'arabic',
remote: '/ajax/autocomplate?type='+1+'&q=%QUERY',
limit: 10 ,
valueKey : 'arabic_term',
});
}
function autocomplete2(phr_type) {
$('.typeahead2').typeahead({
name: 'arabic',
remote: '/ajax/autocomplate?id=3&q=%QUERY',
limit: 10 ,
valueKey : 'arabic_term',
});
}
我有两个输入
<input type="text" class="typeahead2"/>
<input type="text" class="typeahead"/>
我使用
初始化自动完成$(document).ready(function(){
autocomplete1();
autocomplete2();
});
但所有请求都从第一个函数中获取参数,当我在第二个输入中键入时,id 参数不会在第二个输入中发送。
查询参数在两个函数中运行良好但没有发送,只有第一个参数发送。
所以所有的请求都会是这样的:
GET http://host/ajax/autocomplate?type=1&q=xy
GET http://host/ajax/autocomplate?type=1&q=zx
我必须解决这个问题并发送动态参数。
谢谢
【问题讨论】:
标签: jquery twitter-bootstrap bootstrap-typeahead