World Cities

부분 유료
분류별 Andres Olvera | 업데이트됨 3달 전 | Location
인기

9 / 10

지연 시간

250ms

서비스 수준

100%

모든 토론으로 돌아가기

List of countries and cities

avatar
robin.sekvard
2년 전

Is it possible to list all countries to dropdown component to choose the one you want and then make a list of cities to choose one according to the chosen country?

avatar
andruxnet commented 2년 전

Hi,

Currently there’s no option to list all countries, because the query parameter is required – although the docs in the API say it isn’t but that’s because I can’t get to modify the settings of the API.

Anyway, what you can do is get a list of countries elsewhere, and then put those in your first dropdown. Then, when the user selects a country, just use it as the query param for this API and set the searchby param to “country”. This will get you a list of all cities in the selected country, then you can just grab all unique cities and show them in a second dropdown.

Hope that helps.

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입
등급: 5 - 투표: 1