XMLHttpRequest Level 2 adds support for the new FormData interface. FormData objects provide 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.
- Companion:
- object
Value members
Concrete methods
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.
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.
- Value parameters:
- name
The name of the field whose data is contained in value.
- value
The field's value. This can be a string or
Blob
(including subclasses such as File). If none of these are specified the value is converted to a string.
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.
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.
- Value parameters:
- blobName
The filename reported to the server (a string), when a
Blob
orFile
is passed as the second parameter. The default filename forBlob
objects is "blob". The default filename forFile
objects is the file's filename.- name
The name of the field whose data is contained in value.
- value
The field's value. This can be a string or
Blob
(including subclasses such as File). If none of these are specified the value is converted to a string.
The delete()
method of the FormData
interface deletes a key and its value(s) from a FormData
object.
The delete()
method of the FormData
interface deletes a key and its value(s) from a FormData
object.
- Value parameters:
- name
The name of the key you want to delete.
The FormData.entries()
method returns an iterator which iterates through all key/value pairs contained in the
FormData
. The key of each pair is a string object, and the value is either a string or a Blob
.
The FormData.entries()
method returns an iterator which iterates through all key/value pairs contained in the
FormData
. The key of each pair is a string object, and the value is either a string or a Blob
.
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.
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.
- Value parameters:
- name
A string representing the name of the key you want to retrieve.
- Returns:
A value whose key matches the specified name. Otherwise,
null
.
The getAll()
method of the FormData
interface returns all the values associated with a given key from within a
FormData
object.
The getAll()
method of the FormData
interface returns all the values associated with a given key from within a
FormData
object.
The has()
method of the FormData
interface returns whether a FormData
object contains a certain key.
The has()
method of the FormData
interface returns whether a FormData
object contains a certain key.
- Value parameters:
- name
A string representing the name of the key you want to test for.
- Returns:
true
if a key ofFormData
matches the specified name. Otherwise,false
.
The FormData.keys()
method returns an iterator which iterates through all keys contained in the FormData
. The
keys are strings.
The FormData.keys()
method returns an iterator which iterates through all keys contained in the FormData
. The
keys are strings.
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.
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.
- Value parameters:
- name
The name of the field whose data is contained in value.
- value
The field's value.
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.
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.
- Value parameters:
- name
The name of the field whose data is contained in value.
- value
The field's value.