Im trying to get json saved into a variable but seems I don't understand everything here. I get json show up in console a once the way I like but after i try to call it again later it only returns promise. How can i get json saved into a variable so I could use objects in json later?
var jsondata = fetch(url).then(
function(u){ return u.json();}
).then(
function(json){
console.log(json);
}
)
console.log(jsondata);
Aucun commentaire:
Enregistrer un commentaire