这篇翻译不完整。请帮忙从英语翻译这篇文章

草案
本页尚未完工.

XMLHttpRequest.responseText 属性返回一个DOMString,它包含对文本的请求的响应,如果请求不成功或尚未发送,则返回null。responseText属性在请求完成之前将会得到部分属性。 如果 XMLHttpRequest.responseType 的值不是 text 或者空字符串,届时访问 XMLHttpRequest.responseType 将抛出 InvalidStateError 异常。

Example

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);

Specifications

Specification Status Comment
XMLHttpRequest Living Standard WHATWG living standard

Browser compatibility

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 Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support ? ? ?[1] ? ?
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? ? ? ? ?

[1] Before IE 10, the value of XMLHttpRequest.responseText could be read only once the request was complete.

文档标签和贡献者

此页面的贡献者: ScottCXQ, xgqfrms-GitHub, Dcfm
最后编辑者: ScottCXQ,