From dec53c09f3013c49ec7a8802d00fd4ddff85f926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Fri, 27 Aug 2021 07:27:42 +0800 Subject: [PATCH] Replaced JavaScript XMLHttpRequest.onreadystatechange with XMLHttpRequest.onload. --- accounting/static/accounting/js/account-form.js | 4 ++-- accounting/static/accounting/js/transaction-form.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/accounting/static/accounting/js/account-form.js b/accounting/static/accounting/js/account-form.js index 8b2ca63..280d5c6 100644 --- a/accounting/static/accounting/js/account-form.js +++ b/accounting/static/accounting/js/account-form.js @@ -50,8 +50,8 @@ let accounts; */ function getAllAccounts() { const request = new XMLHttpRequest(); - request.onreadystatechange = function() { - if (this.readyState === 4 && this.status === 200) { + request.onload = function() { + if (this.status === 200) { accounts = JSON.parse(this.responseText); } }; diff --git a/accounting/static/accounting/js/transaction-form.js b/accounting/static/accounting/js/transaction-form.js index d6b43fb..1abfb39 100644 --- a/accounting/static/accounting/js/transaction-form.js +++ b/accounting/static/accounting/js/transaction-form.js @@ -91,8 +91,8 @@ let accountOptions; */ function getAccountOptions() { const request = new XMLHttpRequest(); - request.onreadystatechange = function() { - if (this.readyState === 4 && this.status === 200) { + request.onload = function() { + if (this.status === 200) { accountOptions = JSON.parse(this.responseText); $(".record-account").each(function () { initializeAccountOptions($(this));