From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/xmlhttprequest/abort/index.html | 78 ++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 files/ja/web/api/xmlhttprequest/abort/index.html (limited to 'files/ja/web/api/xmlhttprequest/abort') diff --git a/files/ja/web/api/xmlhttprequest/abort/index.html b/files/ja/web/api/xmlhttprequest/abort/index.html new file mode 100644 index 0000000000..49beadf373 --- /dev/null +++ b/files/ja/web/api/xmlhttprequest/abort/index.html @@ -0,0 +1,78 @@ +--- +title: XMLHttpRequest.abort() +slug: Web/API/XMLHttpRequest/abort +tags: + - AJAX + - API + - HTTP + - HttpRequest + - XMLHttpRequest + - abort + - cancel + - メソッド + - リファレンス + - 停止 +translation_of: Web/API/XMLHttpRequest/abort +--- +
{{APIRef('XMLHttpRequest')}}
+ +

XMLHttpRequest.abort() メソッドは、すでに送信された要求を中止します。要求が中止されたら、 {{domxref("XMLHttpRequest.readyState", "readyState")}} が {{domxref("XMLHttpRequest.UNSENT")}} (0) に変化し、要求の {{domxref("XMLHttpRequest.status", "status")}} コードが0に設定されます。

+ +

構文

+ +
XMLHttpRequest.abort()
+ +

引数

+ +

なし。

+ +

返値

+ +

undefined

+ +

+ +

この例では、 MDN のホームページからコンテンツを読み込み始め、ある条件が発生したときに、 abort() を呼び出すことで転送を中止します。

+ +
var xhr = new XMLHttpRequest(),
+    method = "GET",
+    url = "https://developer.mozilla.org/";
+xhr.open(method, url, true);
+
+xhr.send();
+
+if (OH_NOES_WE_NEED_TO_CANCEL_RIGHT_NOW_OR_ELSE) {
+  xhr.abort();
+}
+
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('XMLHttpRequest', '#the-abort()-method')}}{{Spec2('XMLHttpRequest')}}WHATWG living standard
+ +

ブラウザーの対応

+ + + +

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

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf