Skip to content
Advertisement

Error when trying to populate two chained html dropdown objects with JSON data using jQuery?

I am trying to populate two HTML selects with JSON data, but I keep getting this error: Uncaught TypeError: country.map is not a function for the cities. Can someone tell me what’s wrong with this code?

JavaScript
JavaScript

Advertisement

Answer

Its because you are mapping twice –

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement