Javascript 使用外部Json作为tagit.js的源
我对tagit.js脚本有一些问题 我知道以前有人问过这样的问题: 或 在我的例子中,我可以从外部json加载标记,但没有智能自动完成。当我键入Hello时,插件会显示Json上的整个标记,没有逻辑顺序 我的代码:Javascript 使用外部Json作为tagit.js的源,javascript,jquery,ajax,json,autocomplete,Javascript,Jquery,Ajax,Json,Autocomplete,我对tagit.js脚本有一些问题 我知道以前有人问过这样的问题: 或 在我的例子中,我可以从外部json加载标记,但没有智能自动完成。当我键入Hello时,插件会显示Json上的整个标记,没有逻辑顺序 我的代码: $(function(){ $('#biginput').tagit({ allowSpaces:true, autocomplete: {delay: 0, minLength: 0},
$(function(){
$('#biginput').tagit({
allowSpaces:true,
autocomplete: {delay: 0, minLength: 0},
afterTagAdded: function(event, ui) {
launchsearch();
console.log(ui.tag);
},
afterTagRemoved: function(event, ui) {
launchsearch();
console.log(ui.tag);
},
tagSource: function(search, showChoices) {
var that = this;
$.ajax({
url: "search.json",
data: search,
success: function(choices) {
showChoices(that._subtractArray(choices, that.assignedTags()));
}
});
}
});
});
我试图在JSFIDLE中重现我的问题,但它不起作用。。。
看这里:
我的目标是以json文件为基础实现标记自动完成
这个脚本在github中的更新和维护似乎非常糟糕。也许有更好的这种脚本?试试看。它使用json作为自动完成数据