adding stuff from theme on the prod website

This commit is contained in:
2017-09-09 11:27:28 -05:00
parent 7f446fc953
commit 5225628f8a
5 changed files with 217 additions and 0 deletions
@@ -0,0 +1,26 @@
<script>
window.onload = function () {
refreshComments();
};
function refreshComments() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "./comments");
xhr.onload = function () {
document.querySelector("#comments").innerHTML = xhr.responseText;
};
xhr.send();
}
window.submitComment = function (evt) {
evt.preventDefault();
var xhr = new XMLHttpRequest();
xhr.open('POST', './comments', true);
xhr.send(JSON.stringify({"text": evt.target.querySelector('textarea').value}));
xhr.onload = function () {
refreshComments();
}
}
</script>
<div id="comments"></div>