Weather app : page loads before location

My pen :

Rather than using FCC api i am using google location api to get location. but it takes some time and i have to put a button there to load rest of weather data after it completes getting location. I want something like loading feature. Once i allow page to access my location, page should wait to get every possible data and only then loads.

How is that possible ?

P.S : as always any other suggestions are also welcome.

Just move all the code you have in the callback function of your button’s click event handler into the showPosition function (after the two lines were you assign a1 and b1 values).

Also, you will need to fix a slight issue with the google api. Change the http to https.

Thanks. It worked. I corrected google api as well. :slight_smile: