我目前有一个使用UI自动完成的代码,似乎显示我从我的mysql数据库获得的正确数据.现在我想通过能够接受多于1个值来使事情复杂化.我上下搜索了互联网,仍然无法修复我的代码以便工作,我是jquery的新手,特别是自动完成.这是我到目前为止...
$('#companyautocomplete').autocomplete({
source: function(request, response) {
//separator: ' ',
$.ajax({
url: "company_search.php",
dataType: "json",
data: {
name_startsWith: request.term,
term: $('#companyautocomplete').val(),
},
success: function(data) {
response($.map(data, function(item) {
return {
compid: item.compid,
label: item.value + ' (' + item.address + ', ' + item.city + ', ' + item.state + ', ' + item.zipcode + ')',
value: item.value,
address: item.address + ', ' + item.city + ', ' + item.state + ', ' + item.zipcode,
phone: item.phone,
problematic: item.problematic
}
})) …Run Code Online (Sandbox Code Playgroud)