Exportieren (0) Drucken
Alle erweitern
EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

response property

Returns the response received from the server.

This property is read-only.

Internet Explorer 10

 

Syntax

JavaScript
ptr = object.response

 

Property values

Type: any

The response received for the request or null if no response is received.

Examples

The following example uses the value returned response property to define the source for an image on a webpage.


var xhr = new XMLHttpRequest();
xhr.open("GET", "download?name=" + name, true);
xhr.responseType = "blob";
xhr.onreadystatechange = function () {
  if (xhr.readyState == xhr.DONE) {
    var blob = xhr.response;
    var image = document.getElementById("my-image");
    image.addEventListener("load", function (evt) {
      URL.revokeObjectURL(evt.target.src);
    }
    image.src = URL.createObjectURL(blob);
  }
}
xhr.send();


See also

XMLHttpRequest

 

 

Anzeigen:
© 2015 Microsoft