FormData
The FormData interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the fetch(), XMLHttpRequest.send() or navigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
Methods
[iterator]()
iterator: FormDataIterator<[string, FormDataEntryValue]>;
Returns
FormDataIterator<[string, FormDataEntryValue]>
append()
Call Signature
append(name, value): void;
The append() method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
Parameters
| Parameter | Type |
|---|---|
name | string |
value | string | Blob |
Returns
void
Call Signature
append(name, value): void;
Parameters
| Parameter | Type |
|---|---|
name | string |
value | string |
Returns
void
Call Signature
append(
name,
blobValue,
filename?
): void;
Parameters
| Parameter | Type |
|---|---|
name | string |
blobValue | Blob |
filename? | string |
Returns
void
delete()
delete(name): void;
The delete() method of the FormData interface deletes a key and its value(s) from a FormData object.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
void
entries()
entries(): FormDataIterator<[string, FormDataEntryValue]>;
Returns an array of key, value pairs for every entry in the list.
Returns
FormDataIterator<[string, FormDataEntryValue]>
forEach()
forEach(callbackfn, thisArg?): void;
Parameters
| Parameter | Type |
|---|---|
callbackfn | (value, key, parent) => void |
thisArg? | any |
Returns
void
get()
get(name): FormDataEntryValue | null;
The get() method of the FormData interface returns the first value associated with a given key from within a FormData object. If you expect multiple values and want all of them, use the getAll() method instead.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
FormDataEntryValue | null
getAll()
getAll(name): FormDataEntryValue[];
The getAll() method of the FormData interface returns all the values associated with a given key from within a FormData object.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
has()
has(name): boolean;
The has() method of the FormData interface returns whether a FormData object contains a certain key.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
boolean
keys()
keys(): FormDataIterator<string>;
Returns a list of keys in the list.
Returns
FormDataIterator<string>
set()
Call Signature
set(name, value): void;
The set() method of the FormData interface sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist.
Parameters
| Parameter | Type |
|---|---|
name | string |
value | string | Blob |
Returns
void
Call Signature
set(name, value): void;
Parameters
| Parameter | Type |
|---|---|
name | string |
value | string |
Returns
void
Call Signature
set(
name,
blobValue,
filename?
): void;
Parameters
| Parameter | Type |
|---|---|
name | string |
blobValue | Blob |
filename? | string |
Returns
void
values()
values(): FormDataIterator<FormDataEntryValue>;
Returns a list of values in the list.