开发者

Jquery Autocomplete not showing results [closed]

开发者 https://www.devze.com 2023-02-15 06:43 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

I have the following code:

var acOptions = {
             source:function (request, response) {
                 $.ajax({
                     url: "index.php?option=com_fmw&view=keywords_api&controller=keywords_api&format=raw", 
                     type: "GET", dataType: "json",
                     data: { expr: request.term},
                     sucess: function (data) {
                         response($.map(data, function (item) {
                             return item.value;
                         }))
                     }
                 })
                 }, 
     minChars: 1,
     dataType: 'json'
};

$( "#search_box_input" ).autocomplete(acOptions);

I get the following response from the server:

[{"va开发者_如何学编程lue":"Greater"},{"value":"great"},{"value":"greatly"},{"value":"Greater-Axe"}]

However, the autocomplete field is not showing results, even though I can see that the ajax request got sent and that the server answered. What am I doing wrong?


sucess is spelt wrong. Try success instead.

success: function (data) {
    response($.map(data, function (item) {
        return item.value;
    }))
}
0

精彩评论

暂无评论...
验证码 换一张
取 消