diff options
Diffstat (limited to 'files/fr/web/api/xmlhttprequest')
-rw-r--r-- | files/fr/web/api/xmlhttprequest/load_event/index.md | 41 | ||||
-rw-r--r-- | files/fr/web/api/xmlhttprequest/readystatechange_event/index.md (renamed from files/fr/web/api/xmlhttprequest/onreadystatechange/index.md) | 3 |
2 files changed, 43 insertions, 1 deletions
diff --git a/files/fr/web/api/xmlhttprequest/load_event/index.md b/files/fr/web/api/xmlhttprequest/load_event/index.md new file mode 100644 index 0000000000..8d314127c3 --- /dev/null +++ b/files/fr/web/api/xmlhttprequest/load_event/index.md @@ -0,0 +1,41 @@ +--- +title: XMLHttpRequestEventTarget.onload +slug: Web/API/XMLHttpRequest/load_event +translation_of: Web/API/XMLHttpRequestEventTarget/onload +original_slug: Web/API/XMLHttpRequestEventTarget/onload +--- +{{APIRef("XMLHttpRequest")}} + +The **`XMLHttpRequestEventTarget.onload`** is the function called when an {{domxref("XMLHttpRequest")}} transaction completes successfully. + +## Syntax + + XMLHttpRequest.onload = callback; + +### Values + +- `callback` is the function to be executed when the request completes successfully. It receives a {{domxref("ProgressEvent")}} object as its first argument. The value of *this* (i.e. the context) is the same {{domxref("XMLHttpRequest")}} this callback is related to. + +## Example + +```js +var xmlhttp = new XMLHttpRequest(), + method = 'GET', + url = 'https://developer.mozilla.org/'; + +xmlhttp.open(method, url, true); +xmlhttp.onload = function () { + // Do something with the retrieved data ( found in xmlhttp.response ) +}; +xmlhttp.send(); +``` + +## Specifications + +| Specification | Status | Comment | +| ------------------------------------------------------------------------ | ------------------------------------ | ---------------------- | +| {{SpecName('XMLHttpRequest', '#handler-xhr-onload')}} | {{Spec2('XMLHttpRequest')}} | WHATWG living standard | + +## Browser compatibility + +{{Compat("api.XMLHttpRequestEventTarget.onload")}} diff --git a/files/fr/web/api/xmlhttprequest/onreadystatechange/index.md b/files/fr/web/api/xmlhttprequest/readystatechange_event/index.md index cafc71025b..c9cf4293db 100644 --- a/files/fr/web/api/xmlhttprequest/onreadystatechange/index.md +++ b/files/fr/web/api/xmlhttprequest/readystatechange_event/index.md @@ -1,7 +1,8 @@ --- title: XMLHttpRequest.onreadystatechange -slug: Web/API/XMLHttpRequest/onreadystatechange +slug: Web/API/XMLHttpRequest/readystatechange_event translation_of: Web/API/XMLHttpRequest/onreadystatechange +original_slug: Web/API/XMLHttpRequest/onreadystatechange --- {{APIRef}} |