Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta http-equiv="XUA-Compatible" content="ie=edge" />
- <title>Fetch JSON from api and map lat lon</title>
- </head>
- <body>
- <h1>Hvordan er det i Danmark?</h1>
- <p>
- Vejr: <span id="vejr"></span><br /></span>
- </p>
- <script>
- const api_url = "http://api.openweathermap.org/data/2.5/weather?id=2623032&appid=9d9cd8b565db0a6827e6997df791a133"
- async function getVejr() {
- const response = await fetch(api_url);
- const data = await response.json();
- const { weather } = data;
- `document.getElementById("vejr").textContent = weather;
- document.getElementById("vind").textContent = wind;`
- console.log(weather)
- }
- getVejr();
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement