Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

getdata from fetch api into variable

function getData(url, cb) {
  fetch(url)
    .then(response => response.json())
    .then(result => cb(result));
}

getData(url, (data) => console.log({ data }))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #getdata #fetch #api #variable
ADD COMMENT
Topic
Name
5+4 =