I need to build a project to get into a JS bootcamp I am applying for. They tell me I may only use vanilla JS, specifically that frameworks and Jquery are not permitted. Up to
ES6 has Fetch API which provides a global fetch()
method that provides an easy, logical way to fetch resources asynchronously across the network.
It is easier than XMLHttpRequest
.
fetch(url) // Call the fetch function passing the url of the API as a parameter
.then(function() {
// Your code for handling the data you get from the API
})
.catch(function() {
// This is where you run code if the server returns any errors
});