Help in weather app

Help in weather app
0

#1

Just started making weather application. But it is not working please help me…
here is my code link:link


#2

navigator.geolocation.CurrentPosition is not a function. I believe you meant:

navigator.geolocation.getCurrentPosition(gotLocation);


#3

i tried what you suggested but still not working.


#4

Well, codepen.io was loaded over HTTPS but you are trying to access the OpenWeatherMap api over a non-secure protocol (HTTP).
A workaround would be adding https://crossorigin.me/:

api_url=‘https://crossorigin.me/http://api.openweathermap.org/data/2.5/weather?lat=’+lat+’&lon=’+lon+’&appid=a7cfaa7e3f452ac8a059ea17fd256b03’;


#5

oh yeah!! Thank you. it is displaying the results but don’t know what the result exactly meant… can you check the new link again now https://codepen.io/shwetarajput012/pen/dXgazR?editors=0010


#6

You get the temperature. The value is in Kelvin degrees if you do not specify the format when requesting data from OpenWeatherMap.
Check more about their API here: http://openweathermap.org/current


#7

thank you for the help.:slight_smile:


#8

it is now displaying the result in celcius as i wanted. But i want to ask one more thing is that it is displaying 25.6 degree celcius but when i look for temperature in other application they are showing 33 degree celcius. Why is that so? And thank YOU for the help so far.


#9

Do not use other application to compare your results. If you are using OpenWeatherMap, then it would be better you compare your results there: http://openweathermap.org/find?q=

Probably other applications get their data from different sources, update data slower or not accurately. Who knows.


#10

oh yes it worked thank you.