"Show the Local Weather Help" Need help please


Need help on “Show the local weather” project


Sorry, but your code is absolutely unreadable in this format. It’s always better to provide us with a link to your codepen.io, or any other website.

Heve you tried console.log(response) in your callback function?


I just added a link as you have suggested.-Thanks


I replaced the url in the Ajax call with

url: 'https://fcc-weather-api.glitch.me/api/current?lon='+position.coords.longitude+'&lat='+position.coords.latitude,

Then I replaced:




And it works.

There is no city property in the response. The name of the city is stored in response.name. I suggest outputting the response to the console like @N4thyra said next time you have a problem like this.


That’s much better. It’s not just me who doesn’t like looking at such a HUGE chunk of code.

   url:'http//api.openweathermap.org/data/2.5/forecast?lat=34&lon=-84&appid=dd15e8ebfc2c02cf0af09be6ff83a252',//this http://code works from regular address line
  type: 'GET',
   success: function(response){
      //var myTemp = response.main.temp;
   $("#c").text(response.city.name);//this does nto give any result
     $("#t").text(response.main.temp);//this does not give any results
 } //function response
  1. try putting your URL into any browser, I guarantee you it is NOT going to work. It’s not a valid URL address. You’re missing the magic colon
  2. You’re using getJSON, but you’re using ajax syntax at the same time(I’m pretty new to ajax and stuff, and I may be wrong, but I doubt I am).

This is what, e.g. my getJSON function looks like:

  function getLocation() {
    $.getJSON(ipURL, coords => {
      let { latitude, longitude } = coords;
      console.log(latitude, longitude);
      let coordsURL= `lat=${latitude}&lon=${longitude}`;
      URL = `${apiURL}${coordsURL}&APPID=cfdc05d02854f871e2eae7e3a0988b1f&units=metric`;

ajax syntax:

  dataType: "json",
  url: url,
  data: data,
  success: success

I highly recommend that you look for another api. I also used the one that you’re trying to use, and it sucks since you’re going to need to find a way to fix issues with security errors.

I used a proxy server in my project, so the URL address looks like this (not the best solution!!!)



N4thyra and MatiasPi, Thanks for suggestions. I will change the source to get weather from https site instead of http://openweather and stick to .ajax since rest of the code is for that. I will let you know tomorrow about this. Again, thank you very much for your time and help.Goodnight.


ajax/api/console problem

I can not get the output at console. Please help me to figure out what I’m doing wrong here. Thanks


response doesn’t have a time property - otherwise seems to be working ok.


Thanks, but unfortunatleyI deleted part of the code. I will re-type and check this out. My consol statement was


Can someone help me to find the problem with code. I had placed console.log along the way with comments about which one works. I do not know why some of the console.log does not work.
Here is my code…

Thank you very much.


You have a function called getLocation(), but you never call it. To run it, you can a call to it like the following:


right before the following console.log():

console.log("before closing ready function"); //works