0
我正在使用jQuery自動完成大量數據。我的代碼是在這個片段:jQuery自動完成顯示相同的結果
$(function() {
$(".postal-code-autocomplete").autocomplete({
source: postal_codes,
minLength: 3,
});
});
然而,當自動完成做,我有我的結果回來了,它仍然顯示了一些具有相同值,一個我一直在尋找的記錄,如圖所示圖片:
我想這下拉列表中有相同的結果不會出現時,我的結果被發現。
非常感謝!
編輯:如果我console.log(postal_codes)
我得到下面的結果
(54767) ["15354", "13341", "13675", "13451", "17455", "15127", "15562", "14561", "13671", "12241", "13451", "15341", "13561", "17341", "17343", "12244", "15349", "13343", "16452", "16672", "16673", "15235", "16233", "15354", "16777", "14122", "13122", "13231", "13121", "13123", "17778", "17676", "13451", "14562", "14123", "15124", "15127", "14671", "15236", "17121", "14342", "15451", "12134", "12132", "15121", "15237", "12462", "15232", "15561", "15562", "15452", "12351", "15341", "13561", "12244", "13341", "16452", "13671", "15235", "16233", "16777", "15772", "14122", "13122", "13451", "14562", "14123", "15124", "15127", "14231", "15236", "14342", "15451", "17563", "15236", "12136", "12461", "13231", "15121", "15237", "15452", "13451", "16777", "13342", "16122", "17121", "16342", "16777", "16777", "15773", "16777", "15773", "15772", "13122", "10431", "10432", "10433", "10434", "11251", "16452"…]
郵政編碼是什麼樣的?你確定這不是重複的價值嗎?在web開發人員控制檯中執行'console.log(postal_codes)'並檢查結果。 –
請分享您在郵政編碼中收到的內容。 – Shiladitya
console.log(postal_codes)將我的郵政編碼的數值返回給我 – Stefanos