Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.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
jQuery UI无法使用外部JSON文件进行筛选-列出所有项目_Json_Jquery Ui_Filter_External - Fatal编程技术网

jQuery UI无法使用外部JSON文件进行筛选-列出所有项目

jQuery UI无法使用外部JSON文件进行筛选-列出所有项目,json,jquery-ui,filter,external,Json,Jquery Ui,Filter,External,My ext.JSON(无法编辑): 我的jQueryUI自动完成: $('.tables .new_bill .client').autocomplete({ source: function (request, response) { $.getJSON("data/clients.json", function (data) { response($.map(data, function (item) { re

My ext.JSON(无法编辑):

我的jQueryUI自动完成:

$('.tables .new_bill .client').autocomplete({
    source: function (request, response) {
        $.getJSON("data/clients.json", function (data) {
            response($.map(data, function (item) {
                return {
                    label: item.name,
                    value: item.name,
                    pic: item.pic
                };
            }));
            response($.ui.autocomplete.filter(array, request.term));
        });
    },
    minLength: 0,
});
无论我键入什么,都会在“自动完成”下拉列表中获得我的ext JSON对象的完整列表…

我发现:

$.getJSON("data/clients.json", function (data) {
    clients=data;
    var clients_ar=[];
    $.each(data, function(k,v) {
        var client=[];
        client['label']=v.name;
        client['value']=v.name;
        client['pic']=v.pic;
        client['id']=k;
        clients_ar.push(client);
    });

    $('.tables .new_bill .client').autocomplete({
        source: clients_ar,
        minLength: 0,
        select: function(event, ui) {
            var client_id=ui.item.id;
            var client_photo=ui.item.pic;
            ....................................
        }
    });
});
$.getJSON("data/clients.json", function (data) {
    clients=data;
    var clients_ar=[];
    $.each(data, function(k,v) {
        var client=[];
        client['label']=v.name;
        client['value']=v.name;
        client['pic']=v.pic;
        client['id']=k;
        clients_ar.push(client);
    });

    $('.tables .new_bill .client').autocomplete({
        source: clients_ar,
        minLength: 0,
        select: function(event, ui) {
            var client_id=ui.item.id;
            var client_photo=ui.item.pic;
            ....................................
        }
    });
});