Jquery UI自动完成的限制结果

用户名

我想问一下,如何限制搜索结果。这是一段代码,负责查询。我只希望有五个自动完成项。

资源:

 function( request, response ) {
        $.ajax({
            type : 'post',
            dataType: "json",
            data: {
                'person':request
            },

            url: 'PersonWatch/all',

            success: function(data) {
                response( $.map( data, function(item, i) {
                        return item.person
                }));
            }
        });
    }
来宾271314

尝试

response($.map(data, function(item, i) {
             return i < 5 ? item.person : null
         })
        );

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章