我正在使用 Jquery tag-it 从远程 json 字符串中获取关键字列表——这很好用。
但是,我现在遇到的情况是,当您键入它试图在
somefile.php?q=foo
(foo 是您刚刚输入的内容。这将向下钻取标签列表以仅显示其中包含“foo”的那些。
我正在使用 Laravel 4,所以我需要基本上更改 ajax 请求,以便它改为/somefile/foo
. 有没有办法做到这一点?我一直在疯狂地寻找,但找不到解决方案。
作为参考,这是我目前拥有的 tag-it 代码:
$("#tags").tagit({
autocomplete: {delay: 0, minLength: 2},
allowSpaces: true,
onlyAvailableTags : false,
tagSource: function(search, showChoices)
{
var that = this;
$.ajax({
url: "/admin/keywords/autocomplete",
data: { term:search.term },
dataType: "json",
success: function(choices)
{
showChoices(that._subtractArray(choices, that.assignedTags()));
}
});
}
});