The FormData
interface provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send()
method. It uses the same format a form would use if the encoding type were set to "multipart/form-data"
.
An object implementing FormData
can directly be used in a for...of
structure, instead of entries()
: for (var p of myFormData)
is equivalent to for (var p of myFormData.entries())
.
Note: This feature is available in Web Workers.
FormData()
FormData
object.FormData.append()
FormData
object, or adds the key if it does not already exist.FormData.delete()
FormData
object.FormData.entries()
iterator
allowing to go through all key/value pairs contained in this object.FormData.get()
FormData
object.FormData.getAll()
FormData
.FormData.has()
FormData
object contains a certain key.FormData.keys()
iterator
allowing to go through all keys of the key/value pairs contained in this object.FormData.set()
FormData
object, or adds the key/value if it does not already exist.FormData.values()
iterator
allowing to go through all values contained in this object.Specification | Status | Comment |
---|---|---|
XMLHttpRequest The definition of 'FormData' in that specification. | Living Standard | FormData defined in XHR spec |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 7 | Yes | 4
|
10 | 12 | 5 |
FormData() constructor |
7 | Yes | 4 | 10 | 12 | 5 |
append |
7 | Yes | 4
|
10
|
12 | 5 |
delete |
50 | No | 39 | No | Yes | 11 |
get |
50 | No | 39 | No | Yes | 11 |
getAll |
50 | No | 39 | No | Yes | 11 |
has |
50 | No | 39 | No | Yes | 11 |
set |
50 | No | 39 | No | No | 11 |
entries |
50 | No | 44 | No | Yes | 11 |
keys |
50 | No | 44 | ? | Yes | 11 |
values |
50 | No | 44 | ? | ? | 11 |
Support of for...of
|
50 | No | 44 | ? | ? | 11 |
Available in workers | Yes | Yes | 39 | No | Yes | Yes |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes
|
Yes | Yes | 4 | 12 | ? | ? |
FormData() constructor |
Yes | Yes | Yes | Yes | 12 | ? | ? |
append |
3
|
? | Yes | 4
|
12 | ? | ? |
delete |
? | 50 | No | Yes | Yes | No | ? |
get |
? | 50 | No | Yes | Yes | No | ? |
getAll |
? | 50 | No | Yes | Yes | No | ? |
has |
? | 50 | No | Yes | Yes | No | ? |
set |
? | 50 | No | Yes | No | No | ? |
entries |
? | 50 | No | 44 | Yes | ? | ? |
keys |
? | 50 | No | 44 | ? | ? | ? |
values |
? | 50 | No | 44 | ? | ? | ? |
Support of for...of
|
? | 50 | No | 44 | ? | ? | ? |
Available in workers | Yes | Yes | Yes | Yes | Yes | No | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FormData