WebProg/front/main.js

36 lines
1.1 KiB
JavaScript
Raw Normal View History

2023-02-07 11:43:09 +04:00
fetch("http://127.0.0.1:8080/date")
.then(response => response.text())
.then((response) => {
console.log(response)
document.getElementById("date").textContent = response
})
function iloveclick() {
var text = document.getElementById("ilovetextfield").value
fetch ("http://127.0.0.1:8080/ilove?thing=" + text)
.then(response => response.text())
.then((response) => {
console.log(response)
document.getElementById("ilovetextfield").value = response
})
}
function askclick() {
var text = document.getElementById("asktextfield").value
fetch ("http://127.0.0.1:8080/ask?question=" + text)
.then(response => response.text())
.then((response) => {
console.log(response)
document.getElementById("asktextfield").value = response
})
}
function upperclick() {
var text = document.getElementById("uppertextfield").value
fetch ("http://127.0.0.1:8080/touppercase?content=" + text)
.then(response => response.text())
.then((response) => {
console.log(response)
document.getElementById("uppertextfield").value = response
})
}