Javascript 在JQuery自动完成中创建链接

Javascript 在JQuery自动完成中创建链接,javascript,jquery,autocomplete,Javascript,Jquery,Autocomplete,当用户单击/选择自动完成项目时,我很难确定在何处插入以及如何实现单击功能。然后,我想对单击的项执行DB查询 我当前的自动完成脚本: $("#search_customer").autocomplete({ source: "search.php", minLength: 1, response: function(event, ui) { if (!ui.content.length) {

当用户单击/选择自动完成项目时,我很难确定在何处插入以及如何实现单击功能。然后,我想对单击的项执行DB查询

我当前的自动完成脚本:

$("#search_customer").autocomplete({
        source: "search.php",
        minLength: 1,       
        response: function(event, ui) {
            if (!ui.content.length) {
                var create_customer = alert('bla bla...');
                    if (create_customer)
                    {
                    console.log('yes');
                    }
                    else
                    {
                    console.log('no');
                    }
            }
        }
    }); 
使用jqueryui自动完成的select回调 e、 g


希望这有帮助。

正是我需要的。非常感谢。
$("#search_customer").autocomplete({
        source: "search.php",
        minLength: 1,  
        select: function(event,ui) {
             var label = ui.item.label; // label of selected item
             var value = ui.item.value; // value of selected item
             // then make an ajax call here to get the data from db.
        },  
        response: function(event, ui) {
            if (!ui.content.length) {
                var create_customer = alert('bla bla...');
                    if (create_customer)
                    {
                    console.log('yes');
                    }
                    else
                    {
                    console.log('no');
                    }
            }
        }
    });