diff --git a/drama/templates/default.html b/drama/templates/default.html
index 78cfba175..4d872e700 100644
--- a/drama/templates/default.html
+++ b/drama/templates/default.html
@@ -225,13 +225,21 @@
this.innerHTML='Reporting comment';
this.disabled = true;
- post('/api/flag/comment/' + id,
- callback = function() {
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", '/api/flag/comment/'+id, true);
+ var form = new FormData()
+ form.append("formkey", formkey());
+ form.append("reason", document.getElementById("reason").value);
- document.getElementById("reportCommentFormBefore").classList.add('d-none');
- document.getElementById("reportCommentFormAfter").classList.remove('d-none');
- }
- )
+ xhr.withCredentials=true;
+
+ xhr.onload=function() {
+ document.getElementById("reportCommentFormBefore").classList.add('d-none');
+ document.getElementById("reportCommentFormAfter").classList.remove('d-none');
+ };
+
+ xhr.onerror=function(){alert(errortext)};
+ xhr.send(form);
}
};