Today, i was doing a really cool project from frontendMentors, a planets website ! We have to do a 8 pages website (each page contains one planet details), we have the choice between writing every planet data directly in the HTML code, or, we can use a local data.JSON to manage it dynamically.
But, I got a problem:
I want to dynamically, with JS and the included data.JSON, write each planet page. So, i was like "Alright, I have to fetch data.JSON, and precise what planet to fetch, like :
fetch(`./data.json/${planetTitle}`)
But it obviously doesn't work like that. So, does anyone knows how to do it ? I'll give further informations like a screen of my JS + a screen of the data.JSON file.
Thx in advance !
There is the solution !