Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
163
rated 0 times [  169] [ 6]  / answers: 1 / hits: 21844  / 6 Years ago, sat, march 31, 2018, 12:00:00

I think this is very difficult...
I want to give the user the possibility to insert a city of world and see last earthquakes around it.
The problem is how create an input list with all cities.



In my form the user must before insert the country:
http://jsfiddle.net/Dimcho/LUZvS/



<div class=datalist-holder>
<input list=country name=country class=datalist-input />
<datalist id=country>
<option value=Afghanistan />
<option value=Albania />
<option value=Algeria />
<option value=American Samoa />
<option value=Andorra />
//...
//...
</datalist>
</div>


and this jsfiddle works very well...



but to insert the city it's a big problem, how is possible ?
How can i find good database with all cities of world with its latitude, longitude and name of city (with region/province) ?



Anyway i can't insert all cities in my page so I had thought to load a single file with all cities of inserted country using javascript.



Is a good idea?



I would like a lot of advice, the important thing are solutions that do not slow down the code and the page. The performances are very important.



Thanks a lot and sorry for my english


More From » html

 Answers
39

I would highly suggest you to load the list of countries or cities dynamically from an API.



You can have a look at the google API and the Teleport API


[#54807] Wednesday, March 28, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rohan

Total Points: 403
Total Questions: 93
Total Answers: 105

Location: Trinidad and Tobago
Member since Mon, Jul 13, 2020
4 Years ago
;