0
我正在致力於自動完成建議基於AutoComplete plugin。我正在使用html js css.Its,當我使用var currency = [「a」,「b」,「a1」,「a2」,「a3」];但它不工作,當我使用JSON響應。當我在輸入字段上鍵入它給未捕獲TypeError:無法讀取屬性'toLowerCase'的未定義的錯誤,但它的工作使用var currency = [「a」,「 b」, 「A1」, 「A2」, 「A3」];自動搜索建議不起作用
/**js for invoking backend service which is in json format**/
function wlCommonInit() {
var currencies = [];
function empautos(result) {
WL.Logger.debug("feed retrieve successsss");
es1(result.responseJSON.Envelope.Body.processResponse.EmpList);
}
function es1(result) {
WL.Logger.debug("Checking here");
for (var i = 0; i <= result.length; i++) {
currencies[i] = result[i].ENAME;
WL.Logger.debug(currencies);
//console
/** ["1, Approver","1222430837 lastname, Mr. 1222430837 firstname",
"A Bakker","A Chunekar","A Gopalan","AGD, Mr. APPROVER","APPROVER, JOURNAL","Aachen, Torben","Aafjes , B"] **/
}
}
$('#autocomplete').autocomplete({
lookup: currencies
});
}
<div id="searchfield">
<form>
<input type="text" name="currency" class="biginput" id="autocomplete"/>
</form>
</div>
貨幣= currencies.map(函數(項目){ \t返回{數據:項,值:項}; – hume
是這是我需要改變 – hume
是的,試試看吧 – blessenm