Design comparison
SolutionDesign
Solution retrospective
Still dont know how to write JS script for update HTML with JSON file. Any clue Friends ?
Community feedback
- @DeanogitPosted 11 months ago
Hello Friend,
There are a few different ways of getting the data from the JSON file.
For this challenge I used the
fetch()
method.⁄⁄ Fetch a JSON file fetch('./data.json') ⁄⁄ Next we need to use the .then() method and the .json() method to parse the response from the fetch() method .then((response) => { return response.json(); }) ⁄⁄ Now another .then() method .then((data) => { ⁄⁄ We now have the parsed data in a format we can use in JavaScript }
Honestly I struggle to explain how this works, so I'm gonna leave this here for now 😵💫
0 - @jonhenrikaavitslandPosted 11 months ago
some resources for you :)
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API https://developer.mozilla.org/en-US/docs/Web/API/Response/json
0@cocotiwakPosted 11 months ago@jonhenrikaavitsland thx. Already update the solution with JSON data now.
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord