开发者

jQuery Autocomplete crashes Google Chrome tab

I am using jQuery autocomplete. I use it all the time without problems. However, in this particular instance, the results are retrieved successfully, but as soon as the options are displayed on the page, the tab crashes completely, with Chrome's dead tab page.

This only happens in Google Chrome.

The problem may, I guess, be unrelated to (but co-incidentally triggered by) the Autocomplete, but in case I am missing something in my Autocomplete code, here it is;

content.find(".saleLine input[name='item']").autocomplete({
    so开发者_运维百科urce: function (request, response) {
        $.ajax({
            dataType: 'json',
            data: "q=" + request.term + "&page=0&pageLength=20",
            url: $("input[name='itemSearchUrl']").val(),
            success: function (data) {
                var list = new Array();
                $.each(data, function (i, item) {
                    list[i] = {
                        label: item.Code + ': ' + item.Name,
                        value: item.ID,
                        item: item
                    };
                });
                response(list);
            },
            error: function (jqXHR, textStatus, errorThrown) {
                response(null)
            }
        });
    },
    minLength: 2,
    select: function (event, ui) {
        var item = ui.item.item;
        var itemSelect = $(this);
        var row = itemSelect.parent().parent();
        itemSelect.hide();
        row.find("td.unit").html(item.Unit);
        var link = $('<a href="#editLine">' + item.Name + '</a>');
        itemSelect.after(link);
    }
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜