]> code.citadel.org Git - citadel.git/blobdiff - webcit-ng/static/js/view_mail.js
upload.c: more progress on returning values
[citadel.git] / webcit-ng / static / js / view_mail.js
index 6c2260020ced461e81a7c76087a51e485ec4d697..3c21682ea309aca7c326a0f709a28f0d7fc4ddaa 100644 (file)
@@ -597,8 +597,8 @@ function upload_file(file) {
        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;
 
@@ -606,11 +606,13 @@ function upload_file(file) {
                        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;
@@ -642,7 +644,6 @@ function upload_unhighlight(e) {
 }
 
 
-
 // Show or hide the attachments window in the composer
 function show_or_hide_attachments() {