课程: Hands-On Introduction: JavaScript

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Fetch data from an API

Fetch data from an API

- [Instructor] Let's use JavaScript to request some data from an open API, and then do something with that data. In this example, I'll use the API from OpenWeatherMap. You can choose to use this API or another API. If you choose a different API, you need to go find a documentation for that to be able to follow along. All you need to use OpenWeatherMap is to get a free account. Once you get the free account, you can click on your name, select "My API keys", and you are taken to the members page where you can set up as many API keys as you want. Once you have an API key, copy it out, go to our exercise files, and go all the way to the bottom here, outside of the current folder. Down to the file called "settings.js." This file will contain all the settings for the weather app you're going to make. I've just isolated them in a separate file, so we only have to deal with them once. From here, I want you to replace this piece of…

内容