0Pricing
JavaScript Academy · Lesson

Making GET Requests

Fetch data and parse JSON responses.

What fetch Does

The Fetch API makes HTTP requests from the browser and returns a Promise. It is the modern replacement for the old XMLHttpRequest.

A Basic GET

Call fetch(url) with a URL. It defaults to the GET method and resolves with a Response object.

fetch("https://api.example.com/users")
  .then((response) => {
    console.log(response.status); // 200
  });

All lessons in this course

  1. Making GET Requests
  2. POST and Sending Data
  3. Handling Errors and Status Codes
  4. Aborting Requests with AbortController
← Back to JavaScript Academy