new FormData()
An interface that provides a way to construct a set of key/value pairs representing form fields and their values.
- Source:
Methods
append(name, value, filename)
Appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the field whose data is contained in value. |
value |
string | Blob | The field's value, can be a string or Blob, otherwise the value is converted to a string. |
filename |
string | (Optional) The filename reported to the server (a string), when a Blob or File is passed as the second parameter. |
- Source:
constructor(form, value)
Constructs a new FormData object.
Parameters:
Name | Type | Description |
---|---|---|
form |
FormData | (Optional) The FormData object will be populated with the form's current keys/values. |
value |
string | Blob | (Optional) A submit button that is a member of the form. |
- Source:
delete(name)
Deletes a key and its value(s) from a FormData object.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the key to be deleted. |
- Source:
get(name) → {string|Blob}
Returns the first value associated with a given key from within a FormData object.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the key to be retrieved. |
- Source:
Returns:
Form data entry value.
- Type
- string | Blob
getAll(name) → {Array}
Returns all the values associated with a given key from within a FormData object.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the key to be retrieved. |
- Source:
Returns:
An array of values whose key matches the specified name, otherwise, an empty list.
- Type
- Array
has(name) → {boolean}
Returns whether a FormData object contains a certain key.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the key to be retrieved. |
- Source:
Returns:
true if a key of FormData matches the specified name, otherwise, false.
- Type
- boolean
set(name, value, filename)
Sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the field whose data is contained in value. |
value |
string | Blob | The field's value, can be a string or Blob, otherwise the value is converted to a string. |
filename |
string | (Optional) The filename reported to the server (a string), when a Blob or File is passed as the second parameter. |
- Source: