XMLHttpRequestEventTarget.onerror
XMLHttpRequestEventTarget.onerror
は、エラーの為に XMLHttpRequest
トランザクションが失敗した場合に呼び出される関数です。
構文
XMLHttpRequest.onerror = callback;
値
callback
は、リクエストが失敗した場合に実行される関数です。
例
var xmlhttp = new XMLHttpRequest(),
method = 'GET',
url = 'https://developer.mozilla.org/';
xmlhttp.open(method, url, true);
xmlhttp.onerror = function () {
console.log("** An error occurred during the transaction");
};
xmlhttp.send();
仕様
仕様 | ステータス | 備考 |
---|---|---|
XMLHttpRequest | 現行の標準 | WHATWG living standard |
ブラウザーの互換性
BCD tables only load in the browser