mozilla

Revision 12855 of FormData

  • Revision slug: DOM/XMLHttpRequest/FormData
  • Revision title: FormData
  • Revision id: 12855
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment one or more formatting changes

Revision Content

{{ gecko_minversion_header("2.0") }}

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.

For details on how to use the FormData object, see Using FormData objects.

Method overview

void append(in DOMString name, in {{ interface("nsIVariant") }} value);

Methods

append()

Appends a key/value pair to the FormData object.

void append(
  in DOMString name,
  in nsIVariant value
); 
Parameters
name
The name of the field whose data is contained in value.
value
The field's value. Can be a {{ domxref("Blob") }}, {{ domxref("File") }}, or a string, if neither, the value is converted to a string.

See also

Revision Source

<p>{{ gecko_minversion_header("2.0") }}</p>
<p>XMLHttpRequest Level 2 adds support for the new <code>FormData</code> interface. <code>FormData</code> 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 <a href="/en/DOM/XMLHttpRequest#send()" title="en/XMLHttpRequest#send()"><code>send()</code></a> method.</p>
<p>For details on how to use the <code>FormData</code> object, see <a href="/en/DOM/XMLHttpRequest/Using_XMLHttpRequest#Using_FormData_objects" title="en/XMLHttpRequest/Using XMLHttpRequest#Using FormData objects">Using FormData objects</a>.</p>
<h2 name="Method_overview">Method overview</h2>
<table class="standard-table"> <tbody> <tr> <td><code>void <a href="/en/DOM/XMLHttpRequest/FormData#append()" title="en/DOM/XMLHttpRequest/FormData#append()">append</a>(in DOMString name, in {{ interface("nsIVariant") }} value);</code></td> </tr> </tbody>
</table>
<h2>Methods</h2>
<h3>append()</h3>
<p>Appends a key/value pair to the <code>FormData</code> object.</p>
<pre>void append(
  in DOMString name,
  in nsIVariant value
); 
</pre>
<h6>Parameters</h6>
<dl> <dt><code>name</code></dt> <dd>The name of the field whose data is contained in <code>value</code>.</dd> <dt><code>value</code></dt> <dd>The field's value. Can be a {{ domxref("Blob") }}, {{ domxref("File") }}, or a string, if neither, the value is converted to a string.</dd>
</dl>
<h2>See also</h2>
<ul> <li><a href="/en/DOM/XMLHttpRequest" title="en/XMLHttpRequest">XMLHttpRequest</a></li> <li><a href="/en/DOM/XMLHttpRequest/Using_XMLHttpRequest" title="En/Using XMLHttpRequest">Using XMLHttpRequest<br> </a></li> <li><a href="/en/DOM/XMLHttpRequest/Using_XMLHttpRequest#Using_FormData_objects" title="en/XMLHttpRequest/Using XMLHttpRequest#Using FormData
    objects">Using FormData objects</a></li> <li><a href="/en/HTML/Element/form" title="en/HTML/Element/form"><code>form</code></a></li>
</ul>
Revert to this revision