How can I import a JSON object from a website without using libraries like JQuery? I'd like to access some data using pure JavaScript. Thanks in advance!
1 Answer
fetch("some url that returns json")
.then(res => {
res.json()
})
.then(data => {
do something with the data
})
1 Comment
Donald Duck is with Ukraine
While this code may answer the question, providing additional context regarding why and/or how this code answers the question improves its long-term value.
fetch, check this out! developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch