Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

FormData

BaselineWidely available *

Note: This feature is available inWeb Workers.

TheFormData interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using thefetch(),XMLHttpRequest.send() ornavigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to"multipart/form-data".

You can also pass it directly to theURLSearchParams constructor if you want to generate query parameters in the way a<form> would do if it were using simpleGET submission.

An object implementingFormData can directly be used in afor...of structure, instead ofentries():for (const p of myFormData) is equivalent tofor (const p of myFormData.entries()).

Constructor

FormData()

Creates a newFormData object.

Instance methods

FormData.append()

Appends a new value onto an existing key inside aFormData object, or adds the key if it does not already exist.

FormData.delete()

Deletes a key/value pair from aFormData object.

FormData.entries()

Returns aniterator that iterates through all key/value pairs contained in theFormData.

FormData.get()

Returns the first value associated with a given key from within aFormData object.

FormData.getAll()

Returns an array of all the values associated with a given key from within aFormData.

FormData.has()

Returns whether aFormData object contains a certain key.

FormData.keys()

Returns aniterator iterates through all keys of the key/value pairs contained in theFormData.

FormData.set()

Sets a new value for an existing key inside aFormData object, or adds the key/value if it does not already exist.

FormData.values()

Returns aniterator that iterates through all values contained in theFormData.

Specifications

Specification
XMLHttpRequest
# interface-formdata

Browser compatibility

See also

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp