aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/ankiweb.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-12-29 11:10:12 -0800
committerAlex Yatskov <alex@foosoft.net>2016-12-29 11:10:12 -0800
commit6c940656ca5ec5a004d402ffd2fcd9a148bd71b4 (patch)
tree01fd3e393e2b51017c57003fa7ac9e464c84e9ef /ext/bg/js/ankiweb.js
parentb9363dc97905f1f564b09cc784df30d0085d33e0 (diff)
GET unless POSTing data
Diffstat (limited to 'ext/bg/js/ankiweb.js')
-rw-r--r--ext/bg/js/ankiweb.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/bg/js/ankiweb.js b/ext/bg/js/ankiweb.js
index dc6a5d49..6a45b9c5 100644
--- a/ext/bg/js/ankiweb.js
+++ b/ext/bg/js/ankiweb.js
@@ -155,9 +155,14 @@ class AnkiWeb {
const xhr = new XMLHttpRequest();
xhr.addEventListener('error', () => reject('failed to execute network request'));
xhr.addEventListener('load', () => resolve(xhr.responseText));
- xhr.open('POST', url);
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- xhr.send(dataEnc);
+ if (dataEnc) {
+ xhr.open('POST', url);
+ xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+ xhr.send(dataEnc);
+ } else {
+ xhr.open('GET', url);
+ xhr.send();
+ }
});
}
}