如何从 jquery 自动完成的搜索方法中的响应中获取数组
How to get array from response inside search method of jquery autocomplete
我有 URL 正在返回 array
。我需要根据需要添加或删除一些键。我需要在搜索函数中获取 array
以便我可以对其进行修改。 fiddle。我怎样才能得到 URL.
$( "#tags" ).autocomplete({
source: ["ask","always", "all", "alright", "one", "foo", "blackberry", "tweet","force9", "westerners", "sport"], //URL response
search:function(event,ui){
console.log(source) //do some
}
});
静态演示 array
fiddle
您可以使用以下方式获取源选项:
$("#tags").autocomplete("option", "source");
参考 (getter): https://api.jqueryui.com/autocomplete/#option-source
我有 URL 正在返回 array
。我需要根据需要添加或删除一些键。我需要在搜索函数中获取 array
以便我可以对其进行修改。 fiddle。我怎样才能得到 URL.
$( "#tags" ).autocomplete({
source: ["ask","always", "all", "alright", "one", "foo", "blackberry", "tweet","force9", "westerners", "sport"], //URL response
search:function(event,ui){
console.log(source) //do some
}
});
静态演示 array
fiddle
您可以使用以下方式获取源选项:
$("#tags").autocomplete("option", "source");
参考 (getter): https://api.jqueryui.com/autocomplete/#option-source