Weather project

Weather project
0

#1

Hello everyone! I’m on the weather project,however,something’s wrong,my “App” should atleast show the temperature in celsius or w/e but ,it doesn’t even asks me if it can use my location. thoughts?


#2

You made the getLocation function that uses the geolocation API but didn’t call it.

function getLocation() {
  // ...
}

// ...

getLocation();

You want the $.ajax function to be called inside the geolocation success function, because this call depends on the availability of the position information. Currently, it will get called immediately, regardless of whether you called getLocation or not.

Your URL is also a bit malformed. the + '"' bit at the end is unnecessary.


#3

I resaved it with all the tips u gave me,however it still doesn’t work…may u take one more look please?


#4

You’re calling the getLocation function inside the getLocation function itself! Call it after the function body. You also need to put the api variable right before the $.ajax call. Finally, you misspelled success in the $.ajax options.


#5

it works finally .thanks sir i’m hyped.