Fetch

Обновлено: 09.03.2023

Визначення та використання

Метод fetch()запускає процес отримання ресурсу з сервера.

Метод fetch()повертає Promise, який вирішує об’єкт Response.

😀 Більше не потрібен XMLHttpRequest.

Синтаксис

fetch(file)

Параметри

ParameterDescription
fileOptional.
The name of a resource to fetch.

Повернене значення

TypeDescription
PromiseA Promise that resolves to a Response object.

Browser Support

fetch

Посмотреть совместимость на Can I use?

fetch

fetch() is not supported in Internet Explorer 11 (or earlier).