[Weather App] Update API on click

[Weather App] Update API on click


Hi Everybody :slight_smile:

I finished my Weather App ==> http://codepen.io/vinceumo/pen/JEZLLY

I have a small issue I would like would like to update the temperature from °C to °F by changing the API url, but when I do it this way the temperature doesn’t change. ==> (line 93 & 99 of the JS) http://codepen.io/vinceumo/pen/WRKRzz

So my question is, Is their a way to change the API link and to have my DOM updated ?

Thanks for the help :slight_smile:


Why would you do another API call?
Just have a function convert the number number to the other,
no API call necessary.


It’s possible to do this but if you dont need to make another API call you really shouldnt as it takes time/resources. Instead you could use a function that converts the number


For now I’m doing the convertion like this, but I was thinking to integrate a search bar in the app to get the weather of other cities. And I noticed that updating the API link didn’t change the DOM.

The question was more general to know how to do it if I want to do a search feature :slight_smile:

I’m going to try the new API call :slight_smile: