$.ajax({
type: "GET",
url: appUrl + '/somepath/tags',
success: function (data) {
for (var i = 0; i < data.length; i++){
entireTags.push(data[i]);
}
$("#search").autocomplete({source: entireTags});
}
});
data
看起来像这样:
["tag1", "tag2", "tag3", "tag4", ..., "tagN"]
输入文字后,按向下时,它不会自动显示匹配的list.itshows
。
答案 0 :(得分:0)
尝试在for循环之后放置console.log并检查你得到的值是什么 数组“wholeTags”
for (var i = 0; i < data.length; i++){
entireTags.push(data[i]);
}
console.log(entireTags);