57 lines
1.4 KiB
JavaScript
Raw Permalink Normal View History

2023-03-11 21:31:18 +04:00
'use strict'
let num1 = document.getElementById("input1")
let num2 = document.getElementById("input2")
let num3 = document.getElementById("input3")
let num4 = document.getElementById("input4")
let num5 = document.getElementById("input5")
let num6 = document.getElementById("input6")
let num7 = document.getElementById("input7")
let operator = document.getElementById("operator")
let result = document.getElementById("result")
function getFirstChar(){
let s = num1.value
fetch(`http://localhost:8080/FirstCharacter/${s}`)
.then(response => response.text())
.then(data => {result.value = data})
}
function doSum(){
let s1 = num2.value
let s2 = num3.value
fetch(`http://localhost:8080/Sum/${s1}/${s2}`)
.then(response => response.text())
.then(data => {result.value = data})
}
function getYears(){
let s4 = num4.value
fetch(`http://localhost:8080/SayYears/${s4}`)
.then(response => response.text())
.then(data => {result.value = data})
}
function getSubstring(){
let s5 = num5.value
let s6 = num6.value
fetch(`http://localhost:8080/DoSub/${s5}/${s6}`)
.then(response => response.text())
.then(data => {result.value = data})
}
function getArray(){
let s7 = num7.value
fetch(`http://localhost:8080/DoArray/${s7}`)
.then(response => response.text())
.then(data => {result.value = data})
}