diff --git a/lambda/static/js/past_uploads.js b/lambda/static/js/past_uploads.js index ced3887..fd462d6 100644 --- a/lambda/static/js/past_uploads.js +++ b/lambda/static/js/past_uploads.js @@ -173,8 +173,10 @@ function deleteSelected(e) { } function deleteImage(name, callback) { - xmlHttp = new XMLHttpRequest(); - xmlHttp.onreadystatechange = callback; - xmlHttp.open("DELETE", "/file/" + name, true); - xmlHttp.send(); -} \ No newline at end of file + var xmlHttp = new XMLHttpRequest(); + xmlHttp.onreadystatechange = function(e) { + if (e.target.readyState === 4) callback(); + }; + xmlHttp.open("DELETE", "/file/" + name, true); + xmlHttp.send(); +}