XMLHttpRequestEventTarget.onload

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

XMLHttpRequestEventTarget.onload 是 XMLHttpRequest 请求成功完成时调用的函数。

语法

XMLHttpRequest.onload = callback;

  • callback 是请求成功完成时要执行的函数。它接收一个 ProgressEvent 对象作为它的第一个参数。this 的值(即上下文)与此回调的 XMLHttpRequest 相同。

示例

var xmlhttp = new XMLHttpRequest(),
  method = 'GET',
  url = 'https://developer.mozilla.org/';

xmlhttp.open(method, url, true);
xmlhttp.onload = function () {
  // 处理取回的数据(在 xmlhttp.response 中找到)
};
xmlhttp.send();

规范

Specification Status Comment
XMLHttpRequest Living Standard WHATWG living standard

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
onloadChrome Full support YesEdge Full support YesFirefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

文档标签和贡献者

此页面的贡献者: mdnwebdocs-bot, evestorm
最后编辑者: mdnwebdocs-bot,