DEV Community

Margaret W.N
Margaret W.N

Posted on

1

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. 😊

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay