This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
uwu-me/uwume/static/js/user/index.js

31 lines
908 B
JavaScript

const getCurval = function() {
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = updateUwuCounter;
xhttp.open("GET", window.location.href + "/getCurval", true);
xhttp.send();
};
const incCurval = function() {
console.log("TEst");
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = updateUwuCounter;
xhttp.open("POST", window.location.href, true);
xhttp.send();
console.log("anotehrone");
};
const updateUwuCounter = function() {
const uwu_counter = document.getElementById("uwu-counter");
if (!this.response) {
uwu_counter.textContent = uwu_counter.textContent;
} else {
uwu_counter.textContent = this.response;
}
};
window.addEventListener("load", function() {
console.log("View specific JS initialized.");
uwu_button = this.document.getElementById("uwu-button");
uwu_button.onclick = incCurval;
this.setInterval(getCurval, 5000);
});