Suchergebnisse
Für diese Suchanfrage ist keine Übersicht mit KI verfügbarDerzeit kann keine Übersicht mit KI generiert werden. Bitte versuch es später noch einmal.
Übersicht mit KI
To fetch data in JavaScript, you use the global
fetch()method. It starts a network request and returns aPromisethat resolves to aResponseobject.Basic GET Request
javascript
asyncfunctiongetData() {try{constresponse =awaitfetch('http://test.test');// Check if the request was successful (status 200-299)if(!response.ok) {thrownewError(`HTTP error! Status: ${response.status}`); }// Parse the response body as JSONconstdata =awaitresponse.json(); console.log(data); }catch(error) { console.error('Fetch error:', error); } } getData();Verwende Code mit Vorsicht.
POST Request with Options
javascript
asyncfunctionpostData() {constresponse =awaitfetch('http://test.test', { method:'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ name:'John Doe', age:30}) });constresult =awaitresponse.json(); console.log(result); }Verwende Code mit Vorsicht.
Key Components
fetch(url): Initiates the request to the specified resource.response.ok: A boolean that istrueif the HTTP status is in the 200–299 range.response.json(): An asynchronous method that parses the response body into a JavaScript object.- Error Handling: The
fetch()promise only rejects onnetwork failures(like no internet). It doesnotreject for HTTP errors like 404 or 500, so you must checkresponse.okmanually.
For more detailed technical documentation, refer to theMDN Web Docs on Fetch API.
Alle anzeigen
Danke
Dein Feedback hilft Google, künstliche Intelligenz und mehr zu verbessern, auch wenn die Einstellung „Web- & App-Aktivitäten“ deaktiviert ist.Weitere Informationen.
Mehr Feedback geben
Problem melden
Schließen
Danke
Dein Feedback hilft Google, künstliche Intelligenz und mehr zu verbessern, auch wenn die Einstellung „Web- & App-Aktivitäten“ deaktiviert ist.Weitere Informationen.
Mehr Feedback geben
Problem melden
Schließen
Danke
Dein Feedback hilft Google, künstliche Intelligenz und mehr zu verbessern, auch wenn die Einstellung „Web- & App-Aktivitäten“ deaktiviert ist.Weitere Informationen.
Mehr Feedback geben
Problem melden
Schließen
Mehr anzeigen
Web results
Using the Fetch API - MDN Web Docs
MDN Web Docs
http://test.test› ...
MDN Web Docs
http://test.test› ...
20.08.2025—With the Fetch API, youmake a request by calling fetch() , which is available as a global function in both window and worker contexts. You pass ...
Fetch - Современный учебник JavaScript
Современный учебник JavaScript
http://test.test› Сетевые запросы
Современный учебник JavaScript
http://test.test› Сетевые запросы
23.12.2022—Fetch.JavaScriptможет отправлять сетевые запросы на сервер и подгружать новую информацию по мере необходимости. Например, мы можем ...
Использование Fetch - Интерфейсы веб API - MDN Web Docs
MDN Web Docs
http://test.test› ...
MDN Web Docs
http://test.test› ...
24.03.2025—Fetch API предоставляет интерфейс JavaScript для работы с запросами и ответами HTTP. Он также предоставляет глобальный метод fetch() , который ...
JavaScript Fetch API
W3Schools
http://test.test› a...
W3Schools
http://test.test› a...
The fetch() method starts the process of fetching a resource from a server. The fetch() method returns a Promise that resolves to a Response object ...
How to FETCH data from an API using JavaScript ↩️
YouTube · Bro Code
Ca. 372.260 Aufrufe · vor 2 Jahren
YouTube · Bro Code
Ca. 372.260 Aufrufe · vor 2 Jahren
javascript#utorial #course 00:00:00fetch00:06:29 async/await 00:08:55 project //fetch= Function used for making HTTP requests tofetch...
Fetch API in JavaScript
GeeksforGeeks
http://test.test› ...
GeeksforGeeks
http://test.test› ...
31.10.2025—fetch() sends the GET request to the specified URL. The response.json() method parses the JSON response. .then() logs the list of items once ...
Using the JavaScript Fetch API
Medium · Sophia Shoemaker
Ca. 1100 „Gefällt mir“-Angaben · vor 10 Jahren
Medium · Sophia Shoemaker
Ca. 1100 „Gefällt mir“-Angaben · vor 10 Jahren
The fetch() method takes two parameters— the URL that you are requesting (or a Request object) and an “options” object. The method returns a ...
How to Use Fetch API in JavaScript
YouTube · ProgrammingKnowledge
Ca. 2000 Aufrufe · vor 12 Monaten
YouTube · ProgrammingKnowledge
Ca. 2000 Aufrufe · vor 12 Monaten
What theFetchAPI is and why it's useful · How to make a *GET request* tofetchdata · How to handle *JSON responses* · How to use `async/await ...
fetch() — JavaScript
Дока
http://test.test› js › fetch
Дока
http://test.test› js › fetch
14.05.2026—С помощью глобальной функцииfetch() можно выполнять HTTP-запросы— как получать, так и отправлять данные. Функция возвращает промис, который ...
Using Fetch API to Access JSON - javascript
Stack Overflow
3 Antworten · vor 9 Jahren
Stack Overflow
3 Antworten · vor 9 Jahren
I am trying to use fetch api to bring back some data, however am unable to map it to the console once I have retrieved it. Copyfetch('http://test.test ...
3 Antworten·Top-Antwort:The Fetch API returns a response stream in the promise. The response stream is not JSON, so ...