let upperButton = document.getElementById("upperbutton"); let lowerButton = document.getElementById("lowerbutton"); let reverseButton = document.getElementById("reversebutton"); let shuffleButton = document.getElementById("shufflebutton"); let Input = document.getElementById("input"); let Output = document.getElementById("output"); let dop = document.getElementById("dop"); upperButton.onclick = function() { changetext("Upper"); }; lowerButton.onclick = function() { changetext("Lower"); }; reverseButton.onclick = function() { changetext("Reverse"); }; shuffleButton.onclick = function() { changetext("Shuffle"); }; dop.onclick = function() { changetext("Dop"); }; function changetext(str) { let address; address = str; executeRequest(address); } function executeRequest(address) { let _input = Input.value; console.log(_input); fetch(`http://localhost:8080/${address}?Inputtext=${_input}`) .then(response => response.text()) .then(res => Output.value = res); }