0% found this document useful (0 votes)
39 views2 pages

Weather Dashboard

This document outlines a simple weather dashboard built with JavaScript and the OpenWeather API. It allows users to input a city name and fetches the current weather information, displaying the temperature and weather conditions. The code includes an HTML structure and a JavaScript function to handle the API request and update the webpage with the fetched data.

Uploaded by

aniezahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views2 pages

Weather Dashboard

This document outlines a simple weather dashboard built with JavaScript and the OpenWeather API. It allows users to input a city name and fetches the current weather information, displaying the temperature and weather conditions. The code includes an HTML structure and a JavaScript function to handle the API request and update the webpage with the fetched data.

Uploaded by

aniezahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

3.

Weather Dashboard (JavaScript + OpenWeather API)

Features: Fetches weather info by city name.

[Link]

html

CopyEdit

<!DOCTYPE html>

<html>

<head>

<title>Weather App</title>

</head>

<body>

<h2>Weather</h2>

<input id="city" placeholder="Enter city">

<button onclick="getWeather()">Search</button>

<p id="output"></p>

<script>

const API_KEY = 'YOUR_API_KEY'; // Get from [Link]

async function getWeather() {

const city = [Link]('city').value;

const response = await fetch(`[Link]


{city}&appid=${API_KEY}&units=metric`);

const data = await [Link]();

[Link]('output').innerHTML =

`Temp: ${[Link]}°C <br> Weather: ${[Link][0].main}`;


}

</script>

</body>

</html>

You might also like