Skip to main content

Fetch API


The Fetch API allows JavaScript to communicate with the server using HTTP requests and is a better replacement for the XMLHttpRequest class. Queries are executed by the fetch() method, which returnsπŸ”„ Promise.




fetch(url, { options })
  • url - URL for sending the request;
  • options - request parameters.

By specifying the fetch() method without options, you will receive a GET request that fetch data from the URL.

Parameters request#


The second argument to {options} accepts request parameters. Parameter list:

  1. method - request method (GET, POST, PUT, DELETE, HEAD);
  2. headers - HTTP headers;
  3. body - request body (used for method: POST / PUT);
  4. cache - caching mode (default, reload, no-cache);
  5. mode - request mode (cors, no-cors, same-origin);
  6. redirect - specifies how to handle redirects (follow, error, manual);
  7. referrer - request referrer;
  8. signal - AbortSignal, interrupt request;
  9. credentials - sending cookies along with the request - mit, same-origin.
fetch('', {  method: 'GET',  headers: {    'Content-Type': 'application/json'  },  mode: 'no-cors'})


Now you are on a stripped-down version of the site, after subscribing to Patreon, you will get full access to the training course, as well as access to our server's private channels in Discord.

Download our mobile application or get tested in our JavaScript telegram bot, and also subscribe to our news.

Become a Patron!

Sumerian school


  1. Learn JavaScript
  2. MDN Web Docs
  3. JS Tutorial

Contributors ✨#

Thanks goes to these wonderful people (emoji key):



Dmitriy Vasilev



πŸ› 🎨 πŸ–‹


πŸ–‹ πŸ› 🎨

Become a Patron!