31 lines
908 B
JavaScript
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);
|
|
});
|