Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
137 lines (72 loc) · 2.84 KB
/
Copy pathscript.js
File metadata and controls
137 lines (72 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// var displayDayCards = document.getElementById("dayCards");
// var search = document.getElementById("searchBar");
// var APIKey = aafe4f4c88c16dbb6b700eb070949996;
// var queryURL = "http://api.openweathermap.org/data/2.5/weather?q=" + + "&appid=" + APIKey;
var citySearch = document.querySelector('.cityRequested');
var button = document.querySelector('.searchBar');
var nameOfCity =document.querySelector('.nameOfCity');
var dateOfSearch = document.querySelector('.date');
var icon = document.querySelector('.icon');
var temperature = document.querySelector('.temp');
var humidity = document.querySelector('.humidity');
var windSpeed = document.querySelector('.windSpeed');
var lat = document.querySelector('.displayingLat');
var long = document.querySelector('.displayingLong');
button.addEventListener('click', function(){
fetch('https://api.openweathermap.org/data/2.5/forecast?q='+citySearch.value+'&appid=aafe4f4c88c16dbb6b700eb070949996')
.then(response => response.json())
.then(data =>
{
var displayName = data.city.name;
var displayLat = data.city.coord.lat;
var displayLong = data.city.coord.lon;
nameOfCity.innerHTML = displayName;
lat.innerHTML = displayLat;
long.innerHTML = displayLong;
})
.catch(err => console.log("Make sure your you capatilize the name of your city!"))
})
// async function bruhMan() {
// let bruhSearch = await axios.get("http://api.openweathermap.org/data/2.5/weather?q=" + citySearch + "&appid=aafe4f4c88c16dbb6b700eb070949996");
// console.log(bruhSearch);
// }
// fetch(queryURL)
// .then(data => data.text)
// .tehn
// .catch(error => {
// // handle the error
// });
// async function launch(){
// var fiveAM = document.getElementById("searchBar").value;
// const theURL = `"http://api.openweathermap.org/data/2.5/weather?q=" + ${fiveAM} + "&appid=aafe4f4c88c16dbb6b700eb070949996"`;
// const actualQURL = await fetch(theURL);
// const moreWaiting = await actualQURL;
// console.log(moreWaiting);
// // document.getElementById("demo").innerHTML = city;
// // localStorage.setItem("bruh2", bruh);
// }
// value!!!!
// var outtaHere = localStorage.getItem("bruh2");
// makes it a string in storage but not outside?
// var parsed = JSON.parse(outtaHere);
// var stringed = JSON.stringify(outtaHere);
// $("#formID").submit(function(e) {
// e.preventDefault();
// });
// console.log(outtaHere);
// console.log(queryURL);
// function bruhHeader(){
// Text.style.color = 'white';
// }
// function renderDayCard(){
// var bruh = `
// <div>
// Talk here and insert an item eventuallity
// </div>`
// displayDayCards.innerhtml += bruh
// };
// renderDayCard();
// // function RenderStuff(){
// displayDayCard();
// };
// RenderStuff();