我想在两个 json 变量中搜索数据但没有运气。这是我的自动完成代码
$('#tag_name').autocomplete({
source: location_json_array
minLength: 2
});
我的第一个 json 变量
var location_json_array = {"4":{"01817":"\najman corniche road","01818":"\najman downtown","01819":"\najman industrial area","01820":"\najman marina","01821":"\najman meadows","01822":"\najman uptown","01823":"\nal ameera village","01824":"\nal humaid city","01825":"\nal ittihad village","01826":"\nal naemiyah","01827":"\nal rashidiya","01828":"\nal rumaila","01829":"\nal zahraa","01830":"\nawali city","01831":"\ncorniche ajman","01832":"\nemirates city","01833":"\ngreen city","01834":"\nmanama","01835":"\nmarmooka city","01836":"\nmuehat","01837":"\nmusheiref","01838":"\nnew industrial area","01839":"\npark view city","01816":"ain ajman","01343":"Ajman boulevard","03611":"Al Zahraa","03612":"Manama","03613":"Muehat","03614":"Musheiref"},"3":{"01774":"\nAl Brashi","01775":"\nAl Butina","01776":"\nAl Ettihad Street","01777":"\nAl Ghafeyah area","01778":"\nAl Jubail","01779":"\nAl Khaldeia Area","01780":"\nAl Khan","01781":"\nAl Khezamia","01782":"\nAl Majaz","01783":"\nAl Mamzar - Sharjah","01784":"\nAl Mareija","01785":"\nAl Nahda-sharjah","01786":"\nAl Naimiya Area","01787":"\nAl Nekhailat","01788":"\nAl Nouf","01789":"\nAl Nujoom Islands","01790":"\nAl Qasbaa","01791":"\nAl Qasemiya","01792":"\nAl Ramla","01793":"\nAl Riffa Area","01794":"\nAl Shahba","01795":"\nAl Taawon","01796":"\nAl Wahda","01797":"\nCornich Al Buhaira","01798":"\nHalwan","01799":"\nHamriyah Free Zone","01800":"\nMaysaloon","01801":"\nMuelih","01802":"\nRolla Area","01803":"\nSharjah Airport freezone (SAIF)","01804":"\nSharjah Industrial Area","01805":"\nUmm Khanoor","01806":"\nWasit","01773":"Abu shagara","03626":"Al Brashi","03627":"Al Butina","03628":"Al Jubail","03629":"Al Khan","03630":"Al Majaz","03631":"Al Nouf","03632":"Al Qasbaa","03633":"Al Ramla","03634":"Al Shahba","03635":"Al Taawon","03637":"Halwan","03638":"Maysaloon","03639":"Muelih","03640":"Wasit"},"7":{"01807":"\ndowntown fujairah","01808":"\nsheikh hamad bin abdullah st","01809":"corniche al fujairah"},"5":{"01813":"\nemirates modern industrial","01810":"\nkhor al beidah","01811":"\numm al quwain marina","01814":"\nwhite bay","01812":"al salam city","03641":"White Bay"},"2":{"03531":"Abu Dhabi Gate City","01457":"Airport road","03599":"Al Ain Industrial Area","01458":"Al aryam","03532":"Al Badaa","03533":"Al Bahia","03534":"Al Baraha","01459":"Al barza","03535":"Al Bateen","03600":"Al Buraymi","03536":"Al Dhafrah","03537":"Al Falah City","03601":"Al Faqa\u00e2\u20ac\u2122a","03538":"Al Ghadeer","03602":"Al Hili","01460":"Al hosn","03539":"Al Hudayriat Island","03540":"Al Ittihad Road","03603":"Al Jimi","03541":"Al Karama","03604":"Al Khabisi","03542":"Al Khaleej Al Arabi Street","03543":"Al Khalidiya","03544":"Al Maffraq","01461":"Al maha","03545":"Al Manaseer","03546":"Al Manhal","03605":"Al Maqam","03547":"Al Maqtaa","01462":"Al markaz","03548":"Al Markaziyah","03606":"Al Markhaniya","01463":"Al mina","01464":"Al muneera","03549":"Al Mushrif","03550":"Al Nahda Abu Dhabi","01465":"Al nahyan","03551":"Al Nahyan Camp","03552":"Al Najda Street","03553":"Al Qurm","01466":"Al raha","03554":"Al Raha Beach","03555":"Al Raha Gardens","03556":"Al Raha Golf Gardens","03557":"Al Rahba","03558":"Al Rawdah","03559":"Al Reef","01467":"Al reef villas","01468":"Al reem","03560":"Al Reem Island","01469":"Al rehhan","03561":"Al Ruwais","03562":"Al Samha","03563":"Al Shahama","03564":"Al Shamkha","03607":"Al Sinaiya","03565":"Al Sowwah","03608":"Al Tawiya","03566":"Al Wahda","03567":"Al Wathba","03568":"Al Zaab","01470":"Arabian village","03569":"Baniyas","03570":"Between Two Bridges","03571":"Building Materials City","01471":"Capital plaza","03572":"City Downtown","01472":"Corniche","03573":"Corniche Area","03574":"Corniche Road","03575":"Danet Abu Dhabi","03576":"Defence Street","01473":"Delma street","03577":"Desert Village","03578":"Eastern Road","03579":"Electra Street","03580":"Ghantoot","03581":"Grand Mosque District","01474":"Hamdan street","03582":"Hydra Village","03583":"Jawazat Street","01475":"Khalidia","01476":"Khalifa city (all)","01477":"Khalifa city a","01478":"Khalifa city b","01479":"Khalifa city c","03584":"Khalifa Street","03585":"Lulu Island","03586":"Madinat Zayed","03587":"Marina Village","03588":"Masdar City","01480":"Mbz","03589":"Mohamed Bin Zayed City","03590":"Muroor Area","01481":"Musaffah industrial area","01482":"Mushrif","03591":"Mussafah","01483":"New khalifa city","03592":"Nurai Island","01484":"Officers city","05678":"Officers Club Area","03593":"Saadiyat Island","03594":"Salam Street","03595":"Sas Al Nakheel","01485":"Silver wave","01486":"Sky","03609":"Tawam","03596":"Tourist Club Area","03597":"Yas Island","03610":"Zakher","03598":"Zayed Military City"},"1":{"017":"Al Barsha","082":"Al Furjan","04924":"Al Garhoud","05780":"Al Khawaneej","05684":"Al Mamzar","075":"Al Nahda","076":"Al Quoz","072":"Al Rigga","05773":"Al Sufouh","05715":"Al Warqaa","05695":"Al Warsan","05709":"Al Wasl","012":"Arabian Ranches","018":"Bur Dubai","013":"Business Bay","04940":"Culture Village","044":"Deira","036":"DIFC","014":"Discovery Gardens","024":"Downtown Burj Dubai","074":"Dubai Healthcare City","079":"Dubai Internet City","070":"Dubai Investment Park","015":"Dubai Marina","078":"Dubai Media City","05745":"Dubai Waterfront","033":"Dubailand","026":"Emirates Hills","05680":"Festival City","031":"Green Community","020":"Greens","054":"IMPZ","027":"International City","019":"JBR","073":"Jebel Ali","030":"Jumeirah","042":"Jumeirah Golf Estates","04916":"Jumeirah Heights","039":"Jumeirah Islands","022":"Jumeirah Lake Towers","040":"Jumeirah Park","053":"Jumeirah Village","05712":"Jumeirah Village Triangle","034":"Lakes","025":"Meadows","037":"Mirdiff","047":"Motor City","05777":"Muhaisnah","023":"Old Town","035":"Other","05758":"Palm Jebel Ali","016":"Palm Jumeirah","038":"Satwa","028":"Sheikh Zayed Road","055":"Silicon Oasis","043":"Sports City","021":"Springs","048":"TECOM","041":"The Gardens","04934":"The World Islands","029":"Umm Suqueim","032":"Victory Heights","068":"World Trade Centre"},"6":{"01442":"Al hamra (all)","03615":"Al Hamra Village","01443":"Al marjan island","01444":"Bab al bahr","03616":"Cornich Ras Al Khaima","01445":"Cove","03617":"Dana Island","01446":"Golf apartments","01447":"Granada","01448":"Julfar","01449":"Julfar office","01450":"Julfar residential","01451":"Luxury b villa","01452":"Luxury c villa","01453":"Malibu","01454":"Marina apartments","03618":"Mina Al Arab","01455":"Oceana apartments","03619":"RAK Financial City","03620":"RAK Industrial and Technology Park","03621":"Ras Al Khaimah Creek","03622":"Ras al Khaimah Gateway","03623":"Ras Al Khaimah Waterfront","01456":"Royal breeze villas","03624":"Saraya Islands","03625":"Yasmin Village"}};
同样,我有另一个变量,因此如果未找到,则将在第一个中搜索搜索词,然后在第二个中搜索