I am currently working on the weather API app, and I got the geolocation and when attempting to use it I get undefined. When I type Geo in the console it shows me the location. If someone would please help I would be very greatful.

// shows geo in console Geo
{lat: 38.5789724, lng: -121.48376999999999}

when I console.log(weatherlocation) I am getting the url just not with the right location inserted? its showing undefined.

console.log(weatherlocation)[object Object]”


made some changes still getting undefined.

You should do the weather request inside the success callback, because that’s where you get the position information needed by the weather API.

1 Like

YESSS!!! getting return JSON data but google is telling now telling me [Violation] Only request geolocation information in response to a user gesture.

The project is based to come to a website and it autoload on the page. Is it still ok to put a button now that google has put a violation on auto loading pages?


I’m not sure. I think it’s Chrome telling you that you should only get geolocation data when the user explicitly wants to provide it (like allowing the app to get your coordinates when you click a button, as opposed to the app getting your coordinates right when the page loads, without user interaction). Which makes sense. But for this project, it’s up to you.

. Thanks again, should be posting the final project later today.