39 lines
1.5 KiB
JavaScript
39 lines
1.5 KiB
JavaScript
let buttonUp = document.getElementById("buttonUp");
|
|
let buttonDown = document.getElementById("buttonDown");
|
|
let buttonLength = document.getElementById("buttonLength");
|
|
let buttonCountGlas = document.getElementById("buttonCountGlas");
|
|
let wordInput = document.getElementById("word");
|
|
let wordInput2 = document.getElementById("word2");
|
|
let resultInput = document.getElementById("res");
|
|
let buttonCat= document.getElementById("buttonCat");
|
|
buttonUp.onclick = function(event) {
|
|
let wd = wordInput.value;
|
|
fetch(`http://localhost:8080/up?word=${wd}`)
|
|
.then(response => response.text())
|
|
.then(res => resultInput.value = res);
|
|
}
|
|
buttonCat.onclick = function(event) {
|
|
let wd = wordInput.value;
|
|
let wd2 = wordInput2.value;
|
|
fetch(`http://localhost:8080/cat?word1=${wd}&word2=${wd2}`)
|
|
.then(response => response.text())
|
|
.then(res => resultInput.value = res);
|
|
}
|
|
buttonDown.onclick = function(event) {
|
|
let wd = wordInput.value;
|
|
fetch(`http://localhost:8080/down?word=${wd}`)
|
|
.then(response => response.text())
|
|
.then(res => resultInput.value = res);
|
|
}
|
|
buttonLength.onclick = function(event) {
|
|
let wd = wordInput.value;
|
|
fetch(`http://localhost:8080/length?word=${wd}`)
|
|
.then(response => response.text())
|
|
.then(response => resultInput.value = response);
|
|
}
|
|
buttonCountGlas.onclick = function(event) {
|
|
let wd = wordInput.value;
|
|
fetch(`http://localhost:8080/countG?word=${wd}`)
|
|
.then(response => response.text())
|
|
.then(res => resultInput.value = res);
|
|
} |