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"},
...]
作品の完璧な、結果が表示されます。
私はいくつかのカスタム値を設定しよう:
$("#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
});
放火犯リターンの私と全く同じ配列結果:
[...
{ "id": "29083", "label": "SOME ONE 2", "value": "SOMEONE WITH LELE" },
{ "id": "19905", "label": "SOME ONE", "value": "SOMEONE WITH LALA"},
...]
しかし、私はカスタムcaluesを渡すときに問題があり、結果の用量が表示されます。
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しようと、同じ問題で送ります。 –