Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="XUA-Compatible" content="ie=edge" />
  6. <title>Fetch JSON from api and map lat lon</title>
  7. </head>
  8. <body>
  9.  
  10. <h1>Hvordan er det i Danmark?</h1>
  11.  
  12. <p>
  13. Vejr: <span id="vejr"></span><br /></span>
  14. </p>
  15. <script>
  16. const api_url = "http://api.openweathermap.org/data/2.5/weather?id=2623032&appid=9d9cd8b565db0a6827e6997df791a133"
  17. async function getVejr() {
  18. const response = await fetch(api_url);
  19. const data = await response.json();
  20. const { weather } = data;
  21.  
  22. `document.getElementById("vejr").textContent = weather;
  23. document.getElementById("vind").textContent = wind;`
  24.  
  25. console.log(weather)
  26. }
  27. getVejr();
  28. </script>
  29. </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement