我制作了这个脚本并且完美运行:
$('.js_tags').typeahead({
minLength: 3,
source: function (query, process) {
return $.ajax ({
url: '/app/route',
type: 'POST',
data: 'query='+query,
dataType: "json",
async: true,
success: function (data){
process(data);
},
error: function (request, status, error) {
console.log(request.responseText);
}
})
}
});
如何在标签输入中实现我的脚本?
我试过这个,但没有成功:
$('.js_tags').tagsinput({
typeahead:{
minLength: 3,
source: function (query, process) {
return $.ajax ({
url: '/app/route',
type: 'POST',
data: 'query='+query,
dataType: "json",
async: true,
success: function (data){
process(data);
},
error: function (request, status, error) {
console.log(request.responseText);
}
})
},
});
我得到一个:
Uncaught TypeError: process is not a function
我能做些什么?
我尝试了一些东西,但它们都不起作用……我不想使用其他组件……
谢谢