comments.js: include error in reply html rather than using an alert

This commit is contained in:
James Taylor
2020-10-20 18:24:41 -07:00
parent 95f2f027ea
commit c696db3e84
4 changed files with 31 additions and 29 deletions

View File

@@ -41,9 +41,7 @@ function doXhr(url, callback=null) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.onload = (e) => {
let ok = xhr.status >= 200 && xhr.status < 300;
if (ok) callback(e.currentTarget.response);
else alert(`${xhr.responseURL} status code: ${xhr.status}`);
callback(e.currentTarget.response);
}
xhr.send();
return xhr;