Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Create twc-api-script.html
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseWx2011 authored Dec 26, 2023
1 parent fea6531 commit 1f363f3
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions my-scripts/twc-api-script.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<!-- Script Written December 26th 2023 -->
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="", initial scale=1.0"></meta>
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>TWC Api Script</title>
</head>
<body>
<script>
const api_url = 'https://api.weather.com/v1/geocode/38.8034059/-76.9052484/forecast/nowcast.json?language=en-US&units=e&apiKey=e1f10a1e78da46f5b10a1e78da96f525'
async function getWx() {
const response = await fetch(api_url);
const data = await response.json();
console.log(data.latitude);
const {forecast, narrative_512char, } = data;
console.log(narrative_512char);

document.getElementById('wx').textContent = forecast.narrative_512char;

}

getWx();

</script>
<h1>Today:</h1>
<h5 id="wx">The Forecast is unavaliable ;(</h5>

</div>
</div>

</div>
</body>
</html>

0 comments on commit 1f363f3

Please sign in to comment.