GET unless POSTing data
This commit is contained in:
parent
b9363dc979
commit
6c940656ca
|
@ -155,9 +155,14 @@ class AnkiWeb {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.addEventListener('error', () => reject('failed to execute network request'));
|
xhr.addEventListener('error', () => reject('failed to execute network request'));
|
||||||
xhr.addEventListener('load', () => resolve(xhr.responseText));
|
xhr.addEventListener('load', () => resolve(xhr.responseText));
|
||||||
xhr.open('POST', url);
|
if (dataEnc) {
|
||||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
xhr.open('POST', url);
|
||||||
xhr.send(dataEnc);
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||||
|
xhr.send(dataEnc);
|
||||||
|
} else {
|
||||||
|
xhr.open('GET', url);
|
||||||
|
xhr.send();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user