From 9aa43e5d87239108dcebbb44798c62538bae280c Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Sun, 30 Jan 2022 00:38:12 +0900 Subject: 2021/09/15 時点の英語版に同期 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/api/xmlhttprequest/loadend_event/index.md | 142 +++++++++------------ 1 file changed, 63 insertions(+), 79 deletions(-) (limited to 'files/ja') diff --git a/files/ja/web/api/xmlhttprequest/loadend_event/index.md b/files/ja/web/api/xmlhttprequest/loadend_event/index.md index 66c6554f0b..e423934310 100644 --- a/files/ja/web/api/xmlhttprequest/loadend_event/index.md +++ b/files/ja/web/api/xmlhttprequest/loadend_event/index.md @@ -3,60 +3,60 @@ title: 'XMLHttpRequest: loadend イベント' slug: Web/API/XMLHttpRequest/loadend_event tags: - API - - Event + - イベント - NeedsCompatTable - NeedsSpecTable - ProgressEvent - - Reference - - Web - - events - - loadend + - リファレンス + - ウェブ - イベント + - loadend +browser-compat: api.XMLHttpRequest.loadend_event translation_of: Web/API/XMLHttpRequest/loadend_event --- -
{{APIRef}}
+{{APIRef}} -

loadend イベントは、リクエストが完了したときに、成功した場合 ({{domxref("XMLHttpRequest/load_event", "load")}} の後)、成功しなかった場合 ({{domxref("XMLHttpRequest/abort_event", "abort")}} または {{domxref("XMLHttpRequest/error_event", "error")}} の後) のどちらでも発生します。

+**`loadend`** イベントは、リクエストが完了したときに、成功した場合 ({{domxref("XMLHttpRequest/load_event", "load")}} の後)、成功しなかった場合 ({{domxref("XMLHttpRequest/abort_event", "abort")}} または {{domxref("XMLHttpRequest/error_event", "error")}} の後) のどちらでも発行されます。 - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
バブリングなし
キャンセル可能いいえ
インターフェイス{{domxref("ProgressEvent")}}
イベントハンドラープロパティ{{domxref("XMLHttpRequestEventTarget/onloadend", "onloadend")}}
バブリングなし
キャンセル不可
インターフェイス{{domxref("ProgressEvent")}}
イベントハンドラープロパティonloadend
-

+## 例 -

ライブデモ

+### ライブデモ -

HTML

+#### HTML -
<div class="controls">
-    <input class="xhr success" type="button" name="xhr" value="Click to start XHR (success)" />
-    <input class="xhr error" type="button" name="xhr" value="Click to start XHR (error)" />
-    <input class="xhr abort" type="button" name="xhr" value="Click to start XHR (abort)" />
-</div>
-
-<textarea readonly class="event-log"></textarea>
+```html +
+ + + +
- +``` -

JS

+#### JS -
const xhrButtonSuccess = document.querySelector('.xhr.success');
+```js
+const xhrButtonSuccess = document.querySelector('.xhr.success');
 const xhrButtonError = document.querySelector('.xhr.error');
 const xhrButtonAbort = document.querySelector('.xhr.abort');
 const log = document.querySelector('.event-log');
@@ -101,48 +101,32 @@ function runXHR(url) {
     return xhr;
 }
 
-xhrButtonSuccess.addEventListener('click', () => {
-    runXHR('https://mdn.mozillademos.org/files/16553/DgsZYJNXcAIPwzy.jpg');
+xhrButtonSuccess.addEventListener('click', () => {
+    runXHR('https://raw.githubusercontent.com/mdn/content/main/files/en-us/_wikihistory.json');
 });
 
-xhrButtonError.addEventListener('click', () => {
-    runXHR('https://somewhere.org/i-dont-exist');
+xhrButtonError.addEventListener('click', () => {
+    runXHR('http://i-dont-exist');
 });
 
-xhrButtonAbort.addEventListener('click', () => {
-    runXHR('https://mdn.mozillademos.org/files/16553/DgsZYJNXcAIPwzy.jpg').abort();
-});
- -

結果

- -

{{ EmbedLiveSample('Live_example', '100%', '150px') }}

- -

仕様書

- - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName('XMLHttpRequest', '#event-xhr-loadend')}}{{Spec2('XMLHttpRequest')}} 
+xhrButtonAbort.addEventListener('click', () => { + runXHR('https://raw.githubusercontent.com/mdn/content/main/files/en-us/_wikihistory.json').abort(); +}); +``` + +#### 結果 + +{{ EmbedLiveSample('Live_example', '100%', '150px') }} + +## 仕様書 + +{{Specifications}} -

ブラウザーの対応

+## ブラウザーの互換性 -

{{Compat("api.XMLHttpRequest.loadend_event")}}

+{{Compat}} -

関連情報

+## 関連情報 - +- 関連イベント: {{domxref("XMLHttpRequest/loadstart_event", "loadstart")}}, {{domxref("XMLHttpRequest/load_event", "load")}}, {{domxref("XMLHttpRequest/progress_event", "progress")}}, {{domxref("XMLHttpRequest/error_event", "error")}}, {{domxref("XMLHttpRequest/abort_event", "abort")}} +- [進捗の監視](/ja/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#monitoring_progress) -- cgit v1.2.3-54-g00ecf