I am thinking to work on two combos for: country and city.
当用户在一只 com船中选择国家时,其城市应居住在城市 com带。
For it:
1.) Prepare 2 javascript variables: first one with countries id and name, second one with cities id, name and country_id
For Countries:
[
{"id":1, "title":"uk"},
{"id":3, "title":"US"},
{"id":6, "title":"CANADA"},
{"id":8, "title":"AUSTRALIA"}
]
and For Cities:
[
{"id":1, "country_id":1, "city":"LONDON"},
{"id":3, "country_id":1, "city":"Manchester"},
{"id":4, "country_id":2, "city":"New YORK"},
{"id":5, "country_id":2, "city":"New Jersey"},
{"id":8, "country_id":8, "city":"MELBOURN"}
]
Now:
1.) How do i populate the above country data to country combobox?
2.) How do i populate the related cities data to the city combobox when user selects the country?