0
내가 그렇게, 자동 완성 사용자 정의 값을 전달하기 위해 노력하고있어 :자동 완성 도스 사용자 정의 값을 전달 결과를 표시하지
내 사용자 정의 작업 값의 해당 문서의 같은 기본 소스 사용 this question
에 본사를 둔 :
을$("#inpPesqCli").autocomplete({
source: "ajax/search.php",
minLength: 2,
autoFocus: true
});
불을 지르고 반환이 (예) :
[...
{ "id": "29083", "label": "SOME ONE 2", "value": "SOMEONE WITH LELE" },
{ "id": "19905", "label": "SOME ONE", "value": "SOMEONE WITH LALA"},
...]
작업의 완벽한 , 결과가 나타납니다.
난 일부 사용자 지정 값을 설정하려고하면 내가 정의 calues를 통과 할 때, 문제는,
[...
{ "id": "29083", "label": "SOME ONE 2", "value": "SOMEONE WITH LELE" },
{ "id": "19905", "label": "SOME ONE", "value": "SOMEONE WITH LALA"},
...]
하지만 :
$("#inpPesqCli").autocomplete({
source: function(request, response) {
$.ajax({
url: "ajax/search.php",
dataType: "jsonp",
data: {
featureClass: "P",
style: "full",
maxRows: 12,
name_startsWith: request.term
},
success: function(data) {
response($.map(data.geonames, function(item) {
return {
label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
value: item.name
}
}));
}
});
},
minLength: 2,
autoFocus: true
});
불을 지르고 리턴이 나에게 정확히 같은 배열 결과의를 결과의 복용량이 나타납니다.
PHP :
$type = "C";
$q = strtolower($_GET["name_startsWith"]); // this i change: custom = name_startsWith/default = term
if (!$q) return;
$res = $p->SomeClass($codemp,$q,$type);
$items = array();
while(!$res->EOF){
$items[$res->fields["NOMCLI"]] = $res->fields["CODCLI"];
$res->MoveNext();
}
// below this, i have the php autocomplete default function, if u need, ask then i post.
내가 누락 무엇인지 잘 모릅니다.
aready 시도, 같은 문제 보냅니다. –