You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Week6/MAKEME.md
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -43,3 +43,27 @@ How to hand in your homework:
43
43
• Your hyf-javascript2/week3 should now contain an index.html, main.css and a script.js file (and the images folder)
44
44
• Place the link to your repository folder in Trello.
45
45
```
46
+
47
+
48
+
## Homework for JavaScript
49
+
Make a website that fetches (= to get) data asynchronously.
50
+
51
+
1) Create a new website with external js file
52
+
53
+
2) Add a button (e.g. 'click me') that when clicked `console.logs` 'you clicked me!'
54
+
55
+
3) Create a function that fetches from [this weather API](https://openweathermap.org/current). For example from [this page] (http://samples.openweathermap.org/data/2.5/weather?q=London,uk&appid=b1b15e88fa797225412429c1c50c122a1). For help on this check this [SO post](https://stackoverflow.com/questions/247483/http-get-request-in-javascript)
56
+
57
+
4) Display the data that you get from the weather API on your web page.
58
+
59
+
5) Now link the two together: When you click the button -> get the data from the weather API and display it on your website
you can see `?q=London,uk` in the URL. These are called "query parameters" and let us specify in detail what we want from the API. Play around with this. For example you can make two buttons that either get data for London or Amsterdam. Or go even more crazy and make users type in a search box 'amsterdam' and then send that to the API by changing the location.
0 commit comments