[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/API/XMLHttpRequest/response [Back]  [Original]

XMLHttpRequest.response - API | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

XMLHttpRequest.response

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..

XMLHttpRequest response ArrayBuffer, Blob, Document, JavaScript Object DOMString responseType.

In this article

var body = XMLHttpRequest.response;

Value

, responseType. , responseType open() , send() .

null, , , responseType "text" (""), , LOADING readyState (3).

.

"" responseType , "text", (, DOMString.)
"arraybuffer" response JavaScript ArrayBuffer .
"blob" response Blob object .
"document" response HTML Document XML XMLDocument, , MIME- . . HTML in XMLHttpRequest , XHR HTML.
"json" response JavaScript object, JSON.
"text" response DOMString object.
"moz-chunked-arraybuffer" "arraybuffer", . response progress , progress, , . response progress . progress response null.
"ms-stream" response ; Internet Explorer.

load(), . XMLHttpRequest readystatechange, readyState DONE (4) response -, load().

( responseType ).

js
var url = "somePage.html"; //A local page

function load(url, callback) {
  var xhr = new XMLHttpRequest();

  xhr.onreadystatechange = function () {
    if (xhr.readyState === 4) {
      callback(xhr.response);
    }
  };

  xhr.open("GET", url, true);
  xhr.send("");
}

Specification
XMLHttpRequest
# the-response-attribute


Web Proxy Viewer  |  New URL  |  Original Page