0
我有一個字符串列表與AccuWeather API名爲WeatherLocationDatabase.txt
,看起來有點像這樣使用:填充一個<select>其值從字符串列表
CityName="Aachen, DE" Location="EUR|DE|GM011|AACHEN" Country="Germany"
CityName="Aalborg, DK" Location="EUR|DK|DA007|AALBORG" Country="Denmark"
CityName="Aalesund, NO" Location="EUR|NO|NO007|AALESUND" Country="Norway"
CityName="Aare, SE" Location="EUR|SE|SW006|AARE" Country="Sweden"
CityName="Aarhus, DK" Location="EUR|DK|DA001|AARHUS" Country="Denmark"
CityName="Aba, NG" Location="AFR|NG|NI008|ABA" Country="Nigeria"
CityName="Abadan, IR" Location="MEA|IR|IR016|ABADAN" Country="Iran"
CityName="Abakan, RU" Location="ASI|RU|RS033|ABAKAN" Country="Russia"
CityName="Abbotsford, CA" Location="NAM|CA|BC|ABBOTSFORD" Country="Canada"
CityName="Abeokuta, NG" Location="AFR|NG|NI000|ABEOKUTA" Country="Nigeria"
CityName="Aberdeen, UK" Location="EUR|UK|UK002|ABERDEEN" Country="United Kingdom"
CityName="Abidjan, CI" Location="AFR|CI|IV002|ABIDJAN" Country="Ivory Coast"
...
有沒有辦法使用Ajax填充一個<select>
應該看起來像這樣使用jQuery?
如果只有該列表使用XML。 – Blender 2011-12-23 02:22:55
肯定, 只看從這個例子中[1] [1] [前一個問題]:http://stackoverflow.com/questions/815103/jquery-best-practice-填充 - 下拉 – melaos 2011-12-23 02:24:13
該問題涉及格式良好的JSON。這個人看起來像他有一個逗號分隔列表。你能格式化這個文本文件來準備它嗎?還是從其他東西的輸出? – Sinetheta 2011-12-23 02:35:37