File tree Expand file tree Collapse file tree 11 files changed +740
-0
lines changed Expand file tree Collapse file tree 11 files changed +740
-0
lines changed Original file line number Diff line number Diff line change 1+ async function fetchData ( ) {
2+ const url = 'https://weather-by-api-ninjas.p.rapidapi.com/v1/weather?city=Faridabad' ;
3+ const options = {
4+ method : 'GET' ,
5+ headers : {
6+ 'X-RapidAPI-Key' : '9ae224ae17msh167ad0acab752d5p1d336fjsn4e3fa840bf04' ,
7+ 'X-RapidAPI-Host' : 'weather-by-api-ninjas.p.rapidapi.com'
8+ }
9+ } ;
10+
11+ try {
12+ const response = await fetch ( url , options ) ;
13+ const result = await response . json ( ) ;
14+ console . log ( result ) ;
15+
16+ // cloud_pct.innerHTML = result.cloud_pct;
17+ tempFaridabad . innerHTML = result . temp ;
18+ feels_likeFaridabad . innerHTML = result . feels_like ;
19+ humidityFaridabad . innerHTML = result . humidity ;
20+ min_tempFaridabad . innerHTML = result . min_temp ;
21+ max_tempFaridabad . innerHTML = result . max_temp ;
22+ wind_speedFaridabad . innerHTML = result . wind_speed ;
23+ wind_degreesFaridabad . innerHTML = result . wind_degrees ;
24+ sunriseFaridabad . innerHTML = result . sunrise ;
25+ sunsetFaridabad . innerHTML = result . sunset ;
26+
27+ // Use the retrieved data as needed
28+ // ...
29+
30+ } catch ( error ) {
31+ console . error ( error ) ;
32+ }
33+ }
34+
35+ fetchData ( ) ;
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
Original file line number Diff line number Diff line change 1+ async function fetchData ( ) {
2+ const url = 'https://weather-by-api-ninjas.p.rapidapi.com/v1/weather?city=Hyderabad' ;
3+ const options = {
4+ method : 'GET' ,
5+ headers : {
6+ 'X-RapidAPI-Key' : '9ae224ae17msh167ad0acab752d5p1d336fjsn4e3fa840bf04' ,
7+ 'X-RapidAPI-Host' : 'weather-by-api-ninjas.p.rapidapi.com'
8+ }
9+ } ;
10+
11+ try {
12+ const response = await fetch ( url , options ) ;
13+ const result = await response . json ( ) ;
14+ console . log ( result ) ;
15+
16+ // cloud_pct.innerHTML = result.cloud_pct;
17+ tempHyderabad . innerHTML = result . temp ;
18+ feels_likeHyderabad . innerHTML = result . feels_like ;
19+ humidityHyderabad . innerHTML = result . humidity ;
20+ min_tempHyderabad . innerHTML = result . min_temp ;
21+ max_tempHyderabad . innerHTML = result . max_temp ;
22+ wind_speedHyderabad . innerHTML = result . wind_speed ;
23+ wind_degreesHyderabad . innerHTML = result . wind_degrees ;
24+ sunriseHyderabad . innerHTML = result . sunrise ;
25+ sunsetHyderabad . innerHTML = result . sunset ;
26+
27+ // Use the retrieved data as needed
28+ // ...
29+
30+ } catch ( error ) {
31+ console . error ( error ) ;
32+ }
33+ }
34+
35+ fetchData ( ) ;
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
Original file line number Diff line number Diff line change 1+ async function fetchData ( ) {
2+ const url = 'https://weather-by-api-ninjas.p.rapidapi.com/v1/weather?city=Jaipur' ;
3+ const options = {
4+ method : 'GET' ,
5+ headers : {
6+ 'X-RapidAPI-Key' : '9ae224ae17msh167ad0acab752d5p1d336fjsn4e3fa840bf04' ,
7+ 'X-RapidAPI-Host' : 'weather-by-api-ninjas.p.rapidapi.com'
8+ }
9+ } ;
10+
11+ try {
12+ const response = await fetch ( url , options ) ;
13+ const result = await response . json ( ) ;
14+ console . log ( result ) ;
15+
16+ // cloud_pct.innerHTML = result.cloud_pct;
17+ tempJaipur . innerHTML = result . temp ;
18+ feels_likeJaipur . innerHTML = result . feels_like ;
19+ humidityJaipur . innerHTML = result . humidity ;
20+ min_tempJaipur . innerHTML = result . min_temp ;
21+ max_tempJaipur . innerHTML = result . max_temp ;
22+ wind_speedJaipur . innerHTML = result . wind_speed ;
23+ wind_degreesJaipur . innerHTML = result . wind_degrees ;
24+ sunriseJaipur . innerHTML = result . sunrise ;
25+ sunsetJaipur . innerHTML = result . sunset ;
26+
27+ // Use the retrieved data as needed
28+ // ...
29+
30+ } catch ( error ) {
31+ console . error ( error ) ;
32+ }
33+ }
34+
35+ fetchData ( ) ;
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
Original file line number Diff line number Diff line change 1+ async function fetchData ( ) {
2+ const url = 'https://weather-by-api-ninjas.p.rapidapi.com/v1/weather?city=London' ;
3+ const options = {
4+ method : 'GET' ,
5+ headers : {
6+ 'X-RapidAPI-Key' : '9ae224ae17msh167ad0acab752d5p1d336fjsn4e3fa840bf04' ,
7+ 'X-RapidAPI-Host' : 'weather-by-api-ninjas.p.rapidapi.com'
8+ }
9+ } ;
10+
11+ try {
12+ const response = await fetch ( url , options ) ;
13+ const result = await response . json ( ) ;
14+ console . log ( result ) ;
15+
16+ // cloud_pct.innerHTML = result.cloud_pct;
17+ tempLondon . innerHTML = result . temp ;
18+ feels_likeLondon . innerHTML = result . feels_like ;
19+ humidityLondon . innerHTML = result . humidity ;
20+ min_tempLondon . innerHTML = result . min_temp ;
21+ max_tempLondon . innerHTML = result . max_temp ;
22+ wind_speedLondon . innerHTML = result . wind_speed ;
23+ wind_degreesLondon . innerHTML = result . wind_degrees ;
24+ sunriseLondon . innerHTML = result . sunrise ;
25+ sunsetLondon . innerHTML = result . sunset ;
26+
27+ // Use the retrieved data as needed
28+ // ...
29+
30+ } catch ( error ) {
31+ console . error ( error ) ;
32+ }
33+ }
34+
35+ fetchData ( ) ;
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
Original file line number Diff line number Diff line change 1+ {"Cloud_pct": 100,
2+ "Temp": 13,
3+ "Feels_like": 12,
4+ "Humidity": 77,
5+ "Min_temp": 11,
6+ "Wax_temp": 15,
7+ "Wind_speed": 4.63,
8+ "Wind_degrees": 250,
9+ "Sunrise": 1684758254,
10+ "Sunset": 1684813682}
11+
12+
13+
14+ cloud_pct = response.cloud_pct
15+ temp = response.temp
16+ feels_like = response.feels_like
17+ humidity = response.humidity
18+ min_temp = response.min_temp
19+ max_temp = response.max_temp
20+ wind_speed = response.wind_speed
21+ wind_degrees = response.wind_degrees
22+ sunrise = response.sunrise
23+ sunset = response.sunset
24+
25+
26+
27+
28+ {
29+ "cloud_pct": 0,
30+ "temp": 19,
31+ "feels_like": 19,
32+ "humidity": 69,
33+ "min_temp": 17,
34+ "max_temp": 19,
35+ "wind_speed": 2,
36+ "wind_degrees": 150,
37+ "sunrise": 1684875241,
38+ "sunset": 1684925291
39+ }
Original file line number Diff line number Diff line change 1+ async function fetchData ( ) {
2+ const url = 'https://weather-by-api-ninjas.p.rapidapi.com/v1/weather?city=Boston' ;
3+ const options = {
4+ method : 'GET' ,
5+ headers : {
6+ 'X-RapidAPI-Key' : '9ae224ae17msh167ad0acab752d5p1d336fjsn4e3fa840bf04' ,
7+ 'X-RapidAPI-Host' : 'weather-by-api-ninjas.p.rapidapi.com'
8+ }
9+ } ;
10+
11+ try {
12+ const response = await fetch ( url , options ) ;
13+ const result = await response . json ( ) ;
14+ console . log ( result ) ;
15+
16+ // cloud_pct.innerHTML = result.cloud_pct;
17+ tempBoston . innerHTML = result . temp ;
18+ feels_likeBoston . innerHTML = result . feels_like ;
19+ humidityBoston . innerHTML = result . humidity ;
20+ min_tempBoston . innerHTML = result . min_temp ;
21+ max_tempBoston . innerHTML = result . max_temp ;
22+ wind_speedBoston . innerHTML = result . wind_speed ;
23+ wind_degreesBoston . innerHTML = result . wind_degrees ;
24+ sunriseBoston . innerHTML = result . sunrise ;
25+ sunsetBoston . innerHTML = result . sunset ;
26+
27+ // Use the retrieved data as needed
28+ // ...
29+
30+ } catch ( error ) {
31+ console . error ( error ) ;
32+ }
33+ }
34+
35+ fetchData ( ) ;
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
Original file line number Diff line number Diff line change 1+ async function fetchData ( ) {
2+ const url = 'https://weather-by-api-ninjas.p.rapidapi.com/v1/weather?city=Shanghai' ;
3+ const options = {
4+ method : 'GET' ,
5+ headers : {
6+ 'X-RapidAPI-Key' : '9ae224ae17msh167ad0acab752d5p1d336fjsn4e3fa840bf04' ,
7+ 'X-RapidAPI-Host' : 'weather-by-api-ninjas.p.rapidapi.com'
8+ }
9+ } ;
10+
11+ try {
12+ const response = await fetch ( url , options ) ;
13+ const result = await response . json ( ) ;
14+ console . log ( result ) ;
15+
16+ // cloud_pct.innerHTML = result.cloud_pct;
17+ tempShanghai . innerHTML = result . temp ;
18+ feels_likeShanghai . innerHTML = result . feels_like ;
19+ humidityShanghai . innerHTML = result . humidity ;
20+ min_tempShanghai . innerHTML = result . min_temp ;
21+ max_tempShanghai . innerHTML = result . max_temp ;
22+ wind_speedShanghai . innerHTML = result . wind_speed ;
23+ wind_degreesShanghai . innerHTML = result . wind_degrees ;
24+ sunriseShanghai . innerHTML = result . sunrise ;
25+ sunsetShanghai . innerHTML = result . sunset ;
26+
27+ // Use the retrieved data as needed
28+ // ...
29+
30+ } catch ( error ) {
31+ console . error ( error ) ;
32+ }
33+ }
34+
35+ fetchData ( ) ;
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
Original file line number Diff line number Diff line change 1+ main {
2+ margin-top : 100px ;
3+
4+ }
5+ body {
6+ background-color : darkblue;
7+ }
8+
9+ .invisible {
10+ display : block;
11+ position : absolute;
12+ }
13+
14+ /* .card-body{
15+ height: 191.333px;
16+ }
17+ .mt-3 li {
18+ font-size: 1.3rem;
19+ } */
20+ .container {
21+ background-image : url (day-with-clouds-weather-app-screen-mobile-interface-design-forecast-weather-background-time-concept-vector-banner_87946-4137.avif);
22+ background-repeat : no-repeat;
23+ background-size : cover;
24+ color : white;
25+ }
26+ .my-4 {
27+ color : white;
28+
29+ }
30+ .common {
31+ font-weight : bolder;
32+ }
33+ .py-3 {
34+ background-color : # 0D6EFD ;
35+ color : white;
36+ font-weight : bolder;
37+ }
38+ .btn : hover {
39+ background-color : # 0D6EFD ;
40+ }
41+ .nav-link : hover {
42+ color : # 0D6EFD ;
43+ }
You can’t perform that action at this time.
0 commit comments