First time connecting to an API (weather)

Its my first time connecting to an API and using it. im using the open weather site. here are some screenshots to give an idea of what im working with.

(what i chose to use from open weather)
openweather

(my html and js)

(my webiste being built NOTE: I am trying to replace only the text in paranthesis)

  • my issue so far: I cant console.log anything being store into the inputValue variable. why isnt it showing up in my dev tools console?

Im not sure . But when I read the code my first question is what is the inner text of searchbar when the js starts? Probably nothing. Maybe try moving that into the event listener. To be clear I am bot knowledgeable in this topic im just making a guess. Good luck.

I would have a console.log inside the event listener to make sure the input value is there. I would build the url string separately and log that out, too. I would then take that url string and put it in an address bar of a browser (or Postman, whatever) to confirm that I get back data. I would check the network tab of the browser dev tools to see if there is an error. I would also have a catch method for my fetch to see if I can log out any errors.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.