27 lines
708 B
JavaScript
27 lines
708 B
JavaScript
function Okclick(clicked) {
|
|
var num = document.getElementById("textFieldNum").value
|
|
var num2 = document.getElementById("textFieldNum2").value
|
|
var id = clicked;
|
|
var argument = "";
|
|
if(id == "1"){
|
|
argument = ("calculateSquare?num=" + num +"&step=" + num2);
|
|
}
|
|
else if (id == "2"){
|
|
argument = ("calculateFactorial?num=" + num);
|
|
}
|
|
else if( id == "3"){
|
|
argument = ("calculateFibbN?num=" + num);
|
|
}
|
|
else if (id == "4"){
|
|
argument = ("calculateLastSimple?num=" + num);
|
|
}
|
|
|
|
fetch ("http://127.0.0.1:8080/" + argument)
|
|
.then(response => response.text())
|
|
.then((response) => {
|
|
console.log(response)
|
|
document.getElementById("res").innerHTML = response
|
|
})
|
|
|
|
}
|