--- title: XMLHttpRequestEventTarget.onloadstart slug: Web/API/XMLHttpRequestEventTarget/onloadstart translation_of: Web/API/XMLHttpRequestEventTarget/onloadstart ---
XMLHttpRequestEventTarget.onloadstart
在{{domxref("XMLHttpRequest")}} 开始传送数据时被调用
XMLHttpRequest.onloadstart = callback;
callback
是开始传送数据时被调用的回调函数var xmlhttp = new XMLHttpRequest(), method = 'GET', url = 'https://developer.mozilla.org/'; xmlhttp.open(method, url, true); xmlhttp.onloadstart = function () { console.log("Download underway"); }; xmlhttp.send();
规范 | 状态 | 说明 |
---|---|---|
{{SpecName('XMLHttpRequest', '#handler-xhr-onloadstart')}} | {{Spec2('XMLHttpRequest')}} | WHATWG 现存标准 |
{{Compat("api.XMLHttpRequestEventTarget.onloadstart")}}