GlobalFetch

suggest change

The GlobalFetch interface exposes the fetch function, which can be used to request resources.

fetch('/path/to/resource.json')
    .then(response => {
        if (!response.ok()) {
            throw new Error("Request failed!");
        }
            
        return response.json();
    })
    .then(json => { 
        console.log(json);
    });

The resolved value is a Response Object. This Object contains the body of the response, as well as it’s status and headers.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents