aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/api/xmlhttprequest/response
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/fr/web/api/xmlhttprequest/response
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/fr/web/api/xmlhttprequest/response')
-rw-r--r--files/fr/web/api/xmlhttprequest/response/index.html181
1 files changed, 181 insertions, 0 deletions
diff --git a/files/fr/web/api/xmlhttprequest/response/index.html b/files/fr/web/api/xmlhttprequest/response/index.html
new file mode 100644
index 0000000000..1e0987e584
--- /dev/null
+++ b/files/fr/web/api/xmlhttprequest/response/index.html
@@ -0,0 +1,181 @@
+---
+title: XMLHttpRequest.response
+slug: Web/API/XMLHttpRequest/response
+tags:
+ - AJAX
+ - Reference
+ - XMLHttpRequest
+translation_of: Web/API/XMLHttpRequest/response
+---
+<div>{{draft}}</div>
+
+<div>{{APIRef('XMLHttpRequest')}}</div>
+
+<div>La propriété <code>XMLHttpRequest.response</code> contient le corps de la réponse. Elle peut être de type ArrayBuffer, Blob, Document, un objet JavaScript ou une DOMString en fonction de la valeur de la propriété <code>XMLHttpRequest.responseType</code>. La réponse ( <code>Value of response</code> ) est nulle si la requête est incomplète ou n'as pas été effectué avec succès. Cependant, si <code>responseType</code> est "text" ou une chaine vide et tant que la requête est en cours ( dans l'état <em>loading</em> ), <code>response</code> peut contenir la réponse partielle.</div>
+
+<div> </div>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <td class="header">Valeur de <code>responseType</code></td>
+ <td class="header">Type de donnée de la propriété <code>response</code></td>
+ </tr>
+ <tr>
+ <td><code>""</code></td>
+ <td>{{domxref("DOMString")}} (valeur par défaut)</td>
+ </tr>
+ <tr>
+ <td><code>"arraybuffer"</code></td>
+ <td>{{domxref("ArrayBuffer")}}</td>
+ </tr>
+ <tr>
+ <td><code>"blob"</code></td>
+ <td>{{domxref("Blob")}}</td>
+ </tr>
+ <tr>
+ <td><code>"document"</code></td>
+ <td>{{domxref("Document")}}</td>
+ </tr>
+ <tr>
+ <td><code>"json"</code></td>
+ <td>
+ <p>Objet JavaScript depuis une réponse JSON.</p>
+ </td>
+ </tr>
+ <tr>
+ <td><code>"text"</code></td>
+ <td>{{domxref("DOMString")}}</td>
+ </tr>
+ <tr>
+ <td><code>"moz-blob"</code> {{non-standard_inline}}</td>
+ <td>
+ <p>Used by Firefox to allow retrieving partial {{domxref("Blob")}} data from progress events. This lets your progress event handler start processing data while it's still being received. {{gecko_minversion_inline("12.0")}}</p>
+ </td>
+ </tr>
+ <tr>
+ <td><code>"moz-chunked-text"</code>{{non-standard_inline}}</td>
+ <td>
+ <p>Similar to <code>"text"</code>, but is streaming. This means that the value in <code>response</code> is only available during dispatch of the <code>"progress"</code> event and only contains the data received since the last <code>"progress"</code> event.</p>
+
+ <p>When <code>response</code> is accessed during a <code>"progress"</code> event it contains a string with the data. Otherwise it returns <code>null</code>.</p>
+
+ <p>This mode currently only works in Firefox. {{gecko_minversion_inline("9.0")}}</p>
+ </td>
+ </tr>
+ <tr>
+ <td><code>"moz-chunked-arraybuffer"</code>{{non-standard_inline}}</td>
+ <td>
+ <p>Similar to <code>"arraybuffer"</code>, but is streaming. This means that the value in <code>response</code> is only available during dispatch of the <code>"progress"</code> event and only contains the data received since the last <code>"progress"</code> event.</p>
+
+ <p>When <code>response</code> is accessed during a <code>"progress"</code> event it contains a string with the data. Otherwise it returns <code>null</code>.</p>
+
+ <p>This mode currently only works in Firefox. {{gecko_minversion_inline("9.0")}}</p>
+ </td>
+ </tr>
+ <tr>
+ <td>"ms-stream"{{non-standard_inline}}</td>
+ <td>
+ <p>Indique que la réponse est une partie d'un téléchargement d'un flux (?). Supporté uniquement pour les requêtes des téléchargements et disponible uniquement dans Internet Explorer.</p>
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+<div class="note">
+<p><strong>Note:</strong> À partir de Gecko 11.0 {{geckoRelease("11.0")}} et de WebKit build 528, ces navigateurs ne permettent plus l'utilisation de l'attribut <code>responseType</code> lors des requêtes synchrones. Cela renvoi l'erreur <code>NS_ERROR_DOM_INVALID_ACCESS_ERR</code>. Ce changement a été proposé au W3C afin d'être standardisé. </p>
+</div>
+
+<h2 id="Example">Example</h2>
+
+<pre class="brush: js">var url = 'somePage.html'; // une page locale
+
+function load(url, callback) {
+  var xhr = new XMLHttpRequest();
+
+  xhr.onreadystatechange = function() {
+    if (xhr.readyState === 4) {
+      console.log(xhr.response); // Par défault une DOMString
+    }
+  }
+
+ xhr.open('GET', url, true);
+  xhr.send('');
+}
+
+</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('XMLHttpRequest', '#the-response-attribute')}}</td>
+ <td>{{Spec2('XMLHttpRequest')}}</td>
+ <td>WHATWG living standard</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p> </p>