Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
XMLHttpRequest の response プロパティは、そのリクエストの本体の内容を、 ArrayBuffer、Blob、Document、JavaScript の Object、文字列など、リクエストの responseType プロパティの値に応じた形で返します。
responseType の値に基づく適切なオブジェクト。 open() を呼び出してリクエストを初期化した後や、 send() を呼び出してリクエストをサーバーに送信する前に、 responseType の値を設定することで、特定の形式でデータを提供するようにリクエストができます。
リクエストが未完了または失敗する場合、値は null です。ただし、 "text" や空の文字列 ("") を使用してテキストデータを読み込む場合は除きます。リクエストがまだ LOADING readyState (3) にある間、レスポンスはこれまでのレスポンスを含むことがあります。
この例で紹介している load() 関数は、サーバーからページを読み込み処理するものです。これは、 XMLHttpRequest オブジェクトを作成し、 readystatechange イベントのリスナーを生成して、その中で readyState イベントが DONE (4) に変わると response が取得し、 load() に渡されたコールバック関数に渡しています。
コンテンツは生のテキストデータとして扱われます(ここでは、既定の responseType を上書きするものがないため)。
| XMLHttpRequest # the-response-attribute |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年9月4日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.