PIbd-23_Nevaeva_K.A._IP/front/scripts.js

27 lines
708 B
JavaScript
Raw Normal View History

2023-02-28 13:11:24 +04:00
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
})
}