diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/api/formdata/entries/index.html | |
parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip |
initial commit
Diffstat (limited to 'files/pt-br/web/api/formdata/entries/index.html')
-rw-r--r-- | files/pt-br/web/api/formdata/entries/index.html | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/files/pt-br/web/api/formdata/entries/index.html b/files/pt-br/web/api/formdata/entries/index.html new file mode 100644 index 0000000000..911c269074 --- /dev/null +++ b/files/pt-br/web/api/formdata/entries/index.html @@ -0,0 +1,77 @@ +--- +title: FormData.entries() +slug: Web/API/FormData/entries +tags: + - API + - FormData + - Iterador + - Referencia + - XMLHttpRequest API + - metodo +translation_of: Web/API/FormData/entries +--- +<p>{{APIRef("XMLHttpRequest")}}</p> + +<p>O método <code><strong>FormData.entries()</strong></code> retorna um {{jsxref("Iteration_protocols",'iterator')}} permitindo percorrer todos os valores de chave/valor contidos nesse objeto. A chave de cada par é um objeto {{domxref("USVString")}}; o valor é {{domxref("USVString")}}, ou um {{domxref("Blob")}}.</p> + +<div class="note"> +<p><strong>Note</strong>: This method is available in <a href="/en-US/docs/Web/API/Web_Workers_API">Web Workers</a>.</p> +</div> + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="syntaxbox">formData.entries();</pre> + +<h3 id="Valor_retornado">Valor retornado</h3> + +<p>Retorna um {{jsxref("Iteration_protocols","iterator")}}.</p> + +<h2 id="Exemplo">Exemplo</h2> + +<pre class="brush: js;highlight:[7]">// Criação de um objeto teste de FormData +var formData = new FormData(); +formData.append('key1', 'value1'); +formData.append('key2', 'value2'); + +// Exibição dos valores chave/valor +for(var pair of formData.entries()) { + console.log(pair[0]+ ', '+ pair[1]); +} +</pre> + +<p>O resultado é:</p> + +<pre>key1, value1 +key2, value2</pre> + +<h2 id="Especificações">Especificações</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Especificação</th> + <th scope="col">Status</th> + <th scope="col">Comentário</th> + </tr> + <tr> + <td>{{SpecName('XMLHttpRequest','#dom-formdata','entries() (as iterator<>)')}}</td> + <td>{{Spec2('XMLHttpRequest')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade_de_navegadores">Compatibilidade de navegadores</h2> + + + +<p>{{Compat("api.FormData.entries")}}</p> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li>{{domxref("XMLHTTPRequest")}}</li> + <li><a href="/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest" title="Using XMLHttpRequest">Using XMLHttpRequest</a></li> + <li><a href="/en-US/docs/DOM/XMLHttpRequest/FormData/Using_FormData_Objects" title="DOM/XMLHttpRequest/FormData/Using_FormData_objects">Using FormData objects</a></li> + <li>{{HTMLElement("Form")}}</li> +</ul> |