diff options
Diffstat (limited to 'files/fr/web/api/xmlhttprequesteventtarget/onload/index.md')
-rw-r--r-- | files/fr/web/api/xmlhttprequesteventtarget/onload/index.md | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/files/fr/web/api/xmlhttprequesteventtarget/onload/index.md b/files/fr/web/api/xmlhttprequesteventtarget/onload/index.md new file mode 100644 index 0000000000..8a6afa0393 --- /dev/null +++ b/files/fr/web/api/xmlhttprequesteventtarget/onload/index.md @@ -0,0 +1,56 @@ +--- +title: XMLHttpRequestEventTarget.onload +slug: Web/API/XMLHttpRequestEventTarget/onload +translation_of: Web/API/XMLHttpRequestEventTarget/onload +--- +<p> </p> + +<div>{{APIRef("XMLHttpRequest")}}</div> + +<p>The <strong><code>XMLHttpRequestEventTarget.onload</code></strong> is the function called when an {{domxref("XMLHttpRequest")}} transaction completes successfully.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><em>XMLHttpRequest</em>.onload = <em>callback</em>;</pre> + +<h3 id="Values">Values</h3> + +<ul> + <li><code><em>callback</em></code> is the function to be executed when the request completes successfully. It receives a {{domxref("ProgressEvent")}} object as its first argument. The value of <em>this</em> (i.e. the context) is the same {{domxref("XMLHttpRequest")}} this callback is related to.</li> +</ul> + +<h2 id="Example">Example</h2> + +<pre class="brush: js">var xmlhttp = new XMLHttpRequest(), + method = 'GET', + url = 'https://developer.mozilla.org/'; + +xmlhttp.open(<em>method</em>, <em>url</em>, true); +xmlhttp.onload = function () { + // Do something with the retrieved data ( found in xmlhttp.response ) +}; +xmlhttp.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', '#handler-xhr-onload')}}</td> + <td>{{Spec2('XMLHttpRequest')}}</td> + <td>WHATWG living standard</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("api.XMLHttpRequestEventTarget.onload")}}</p> |