xhr.open('POST', url, true);
xhr.addEventListener('readystatechange', function(e) {
+ console.log("readyState: " + xhr.readyState);
if (xhr.readyState == 4 && xhr.status == 200) {
- //document.getElementById("ctdl-upload_list").innerHTML += "<li>succeeeeed</li>";
num_attachments += 1;
document.getElementById("num_attachments").innerHTML = num_attachments;
let li = document.getElementById("ctdl_uploading_" + uploads_in_progress.toString());
li.parentNode.removeChild(li);
uploads_in_progress -= 1;
+
+ // what happened?
+ console.log("response: " + xhr.response);
+ console.log("responseText: " + xhr.responseText);
}
else if (xhr.readyState == 4 && xhr.status != 200) {
- //document.getElementById("ctdl-upload_list").innerHTML += "<li>EPIC FAIL</li>";
-
- // remove the "uploading in progress" message (maybe we should replace it with an error?)
+ // remove the "uploading in progress" message (there was an error, so just let it disappear)
let li = document.getElementById("ctdl_uploading_" + uploads_in_progress.toString());
li.parentNode.removeChild(li);
uploads_in_progress -= 1;
}
-
// Show or hide the attachments window in the composer
function show_or_hide_attachments() {