First API XMLHTTP... Opinions?

Finally learning about APIs and all sorts of requests… I could work with them with NodeJS but never straight simple JS like this. This one is with the oldschool XML =)
Opinions wanted
Thanks in advance


Learning about XMLHttpRequest isn’t a bad idea. I would however suggest you don’t use it in your code unless you absolutely have to. Much better to use fetch and async/await (or .then if you prefer).

You may want to implement a guard against when an invalid country is entered. It looks like the API will send back a 404 and you can inform the user that the country entered doesn’t exist (or whatever).

But good job on using an API and implementing data rendering based on the data you get back. It is fun getting data you can use for different apps. In time you will also implement your own APIs which is the next step up in API usage.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.