$('#customer').autocomplete({
minLength: 2,
source: function(request, response) {
$.ajax({
type: 'POST',
url: '<?php echo site_url("daily_tasks/ajax/get_customer_list");?>',
dataType: 'json',
data: {
customer: request.term
},
success: function(data) {
response($.map(data, function(item){
return {
label: item,
value: item
};
}))
}
});
}
});
예제를 설명합니다:
$.post("http://www.test.com",{id:id},function(data){ var i = 0; var availableTags = [data]; alert(availableTags); $("#name_"+i+"").autocomplete({ source: availableTags }); }, 'json');'json'을 추가로 붙여 주세요.