editor technically works

This commit is contained in:
Bel LaPointe
2022-02-15 16:08:24 -07:00
parent 0e1ced34b2
commit 701ba9c48f
4 changed files with 64 additions and 6 deletions

View File

@@ -76,4 +76,23 @@
height: 100%;
}
</style>
<script>
function http(method, remote, callback, body, headers) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE) {
callback(xmlhttp.responseText, xmlhttp.status, (key) => xmlhttp.getResponseHeader(key))
}
};
xmlhttp.open(method, remote, true);
if (typeof body == "undefined") {
body = null
}
if (headers) {
for (var key in headers)
xmlhttp.setRequestHeader(key, headers[key])
}
xmlhttp.send(body);
}
</script>
{{ end }}