Borrador
Esta página no está completa.
La propiedad XMLHttpRequest.responseText
devuelve un DOMString
que contiene la respuesta a la consulta como un texto o null si la consulta no tuvo exito o aun no ha sido completada. la propiedad responseText
tendra una respuesta parcial como retorno aunque la consulta no haya sido completada. si responseType contiene algo que no sea un string vacio o un "text", el acceso a responseText sera throw InvalidStateError
exception.
Ejemplo. Lanza una excepción InvalidStateError
var xhr = new XMLHttpRequest();
xhr.open('GET', '/server', true);
// If specified, responseType must be empty string or "text"
xhr.responseType = 'text';
xhr.onload = function () {
if (xhr.readyState === xhr.DONE) {
if (xhr.status === 200) {
console.log(xhr.response);
console.log(xhr.responseText);
}
}
};
xhr.send(null);
Especificaciones
Especificaciones | estado | Comentarios |
---|---|---|
XMLHttpRequest | Living Standard | WHATWG living standard |
Compatibilidad con navegadores
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | ? | (Yes) | ? | ?[1] | ? | ? |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | ? | ? | (Yes) | ? | ? | ? | ? |
[1] Anteriores a IE 10, El valo de XMLHttpRequest.responseText debe ser leido una vez que la consulta fuera completada.