对于jquery中的自动完成,它不显示列表

时间:2013-06-22 06:47:46

标签: node.js

$.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

1 个答案:

答案 0 :(得分:0)

尝试在for循环之后放置console.log并检查你得到的值是什么 数组“wholeTags”

 for (var i = 0; i < data.length; i++){
        entireTags.push(data[i]);
    }
  console.log(entireTags);