在提前输入js中获取搜索数据的数组名称

Getting array name of search data in type ahead js

$('#search_restaurant').typeahead({
minLength: 1,
order: "asc",
 template: "{{display}} <small style='color:#999;' id={{group}}>{{group}} </small>",
source: {
Restaurant: {
    url: ["sqlfiles/search_data.php", "data.country"]
},
Estb: {
    url: ["sqlfiles/search_data.php", "data.dish"]
},
Sub: {
    url: ["sqlfiles/search_data.php", "data.sub"]
},
Cusines: {
    url: [
        {
            type: "POST",
            url: "sqlfiles/search_data.php",
            data: {myKey: "myValue"}
        },
        "data.capital"
    ]
}
},

});

我在这里使用 运行 coder type ahead js 我正在获取数据,但我想要的是所选数据的数组名称,例如 [=13= 中的 Restaurant、Estb、Sub、Cusines ] 脚本变量

callback: {
    onClickAfter: function (node, a, item, event) {
        // item.group should be what you are looking for
        console.log(item)
    }
}
});

这就是解决方案