blob: 4ceb02aeb4895ebbbb350181ca2afd81666413df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
---
title: Body.formData()
slug: Web/API/Body/formData
translation_of: Web/API/Body/formData
---
<div>{{APIRef("Fetch")}}</div>
<p>Die Methode <strong><code>formData()</code></strong> des {{domxref("Body")}} Mixin nimmt einen {{domxref("Response")}} Stream und liest ihn bis zum Ende. Sie gibt ein Promise zurück, welches in ein {{domxref("FormData")}} Objekt aufgelöst wird.</p>
<div class="note">
<p><strong>Hinweis:</strong> Dies ist hauptsächlich für <a href="/de/docs/Web/API/ServiceWorker_API">Service Worker</a> relevant. Wenn ein Benutzer ein Formular absendet und ein Service Worker die Anfrage abfängt, könnten Sie bspw. <code>formData()</code> aufrufen, um eine Key-Value-Abbildung zu erhalten, einige Felder zu modifizieren und das Formular dann an den Server weiterzuschicken (oder lokal zu benutzen).</p>
</div>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox">response.formData()
.then(function(formdata) {
// machen Sie etwas mit Ihren Formulardaten
});</pre>
<h3 id="Parameter">Parameter</h3>
<p>Keine.</p>
<h3 id="Rückgabewert">Rückgabewert</h3>
<p>Ein Promise, welches in ein {{domxref("FormData")}} Objekt aufgelöst wird.</p>
<h2 id="Beispiel">Beispiel</h2>
<p>Wird nachgereicht.</p>
<h2 id="Spezifikationen">Spezifikationen</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('Fetch','#dom-body-formdata','formData()')}}</td>
<td>{{Spec2('Fetch')}}</td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="Browserkompatibilität">Browserkompatibilität</h2>
<p>{{Compat("api.Body.formData")}}</p>
<h2 id="Siehe_auch">Siehe auch</h2>
<ul>
<li><a href="/de/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
<li><a href="/de/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
<li><a href="/de/docs/Web/HTTP">HTTP</a></li>
</ul>
|