DEV Community

Margaret W.N
Margaret W.N

Posted on

Day 57: Updating data from spott api to a webpage

My aim today was to dynamically update the city name on the web app with the city from the search results. The city name was not been updated yesterday after a get request because i was using country to fetch class country in my query selector instead of .country. I kept running into a "country is null error."
Code before:

const country = document.querySelector('country');
country.textContent = data.name
Enter fullscreen mode Exit fullscreen mode

Code after:

  const country = document.querySelector('.country');
  country.textContent = data.country.name
Enter fullscreen mode Exit fullscreen mode

๐Ÿ˜… I'm literally so angry at that . for taking all my time ๐Ÿ˜‚
Day 57

Top comments (2)

Collapse
 
waelmo profile image
WaeL MoH

these stuffs happen all da time :D dont get mad and keep it up ;)

Collapse
 
mtee profile image
Margaret W.N

I better get used to it. I will keep up. ๐Ÿ˜Š