Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 自定义自动完成搜索_Javascript_Jquery_Jquery Ui - Fatal编程技术网

Javascript 自定义自动完成搜索

Javascript 自定义自动完成搜索,javascript,jquery,jquery-ui,Javascript,Jquery,Jquery Ui,我想实现一个自定义搜索。 我的代码: $(文档).ready(函数(){ $('w-input-search')。自动完成({ 最小长度:1, 延误:500, 来源:功能(请求、响应){ $.getJSON(“/demo/account/getUsers”),请求,函数(结果){ 响应($.map)(结果、功能(项){ 返回{ 标签:“+item.firstName, 值:item.firstName, 标记url:“http://“+window.location.host+”/tags/“+

我想实现一个自定义搜索。 我的代码: $(文档).ready(函数(){

$('w-input-search')。自动完成({
最小长度:1,
延误:500,
来源:功能(请求、响应){
$.getJSON(“/demo/account/getUsers”),请求,函数(结果){
响应($.map)(结果、功能(项){
返回{
标签:“+item.firstName,
值:item.firstName,
标记url:“http://“+window.location.host+”/tags/“+item.tagId+”/“+item.name”
}
}));
});
},
});
这显示:

如何使该列表显示图像而不是文本?”
我必须说我是jquery初学者。

可能重复的可能重复的请阅读autocomplete文档打印html。可以给我看一下您正在使用的插件吗
$('#w-input-search').autocomplete({
    minLength: 1,
    delay: 500,
    source: function (request, response) {
        $.getJSON("/demo/account/getUsers", request, function(result) {
            response($.map(result, function(item) {
                return {                                                                    
                    label: "<img src='" + item.photoUrl + "'/>"+item.firstName ,
                    value: item.firstName,
                    tag_url: "http://" + window.location.host +"/tags/" + item.tagId + "/" + item.name
                }
            }));
        });
    },



});