jQuery的自动完成不显示结果 [英] Jquery Autocomplete not showing results

查看:164
本文介绍了jQuery的自动完成不显示结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的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:

[{"value":"Greater"},{"value":"great"},{"value":"greatly"},{"value":"Greater-Axe"}]

不过,自动完成字段没有显现出效果,即使我可以看到Ajax请求得到了发送和服务器应答。我究竟做错了什么?

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 拼写错了。尝试成功代替。

sucess is spelt wrong. Try success instead.

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

这篇关于jQuery的自动完成不显示结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆