Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

fetchData from json file

const fetchData = async () => {
  try {
    const res = await fetch("js/data.json");
    data = await res.json();
    displayData(data);
  } catch (e) {
    console.log("something went wrong!", e);
  }
};

fetchData();
Source by github.com #
 
PREVIOUS NEXT
Tagged: #fetchData #json #file
ADD COMMENT
Topic
Name
5+2 =