From 0ed936438c655c300a078d227f36af4ecf95824e Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Mon, 2 May 2016 21:50:36 -0700 Subject: [PATCH] WIP --- ext/bg/js/yomichan.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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');