summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/yomichan.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index 32c12407..207ab4d5 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -124,7 +124,7 @@ class Yomichan {
callAnkiApi(action, data, callback) {
if (this.options.enableAnkiConnect) {
const xhr = new XMLHttpRequest();
- xhr.addEventListener('load', () => callback(JSON.parse(xhr.responseText)));
+ xhr.addEventListener('loadend', () => callback(xhr.responseText ? JSON.parse(xhr.responseText) : null));
xhr.open('POST', 'http://127.0.0.1:8888');
xhr.withCredentials = true;
xhr.setRequestHeader('Content-Type', 'text/json');