From a9e7a9fc6bf6b352d57ddca2cad516ddbf0fe911 Mon Sep 17 00:00:00 2001 From: Katerina881 Date: Mon, 13 Feb 2023 17:45:53 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Front/script.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Front/script.js b/Front/script.js index 0adca28..521a1c2 100644 --- a/Front/script.js +++ b/Front/script.js @@ -9,7 +9,10 @@ buttonPlus.onclick = function(event) { let num_2 = numberTwoInput.value; fetch(`http://localhost:8080/sum?first=${num_1}&second=${num_2}`) .then(response => response.text()) - .then(res => resultInput.value = res); + .then(res => { + const ru = new Intl.NumberFormat("ru").format(res); + resultInput.value = ru; + }); } buttonMinus.onclick = function(event) { event.preventDefault(); @@ -17,15 +20,22 @@ buttonMinus.onclick = function(event) { let num_2 = numberTwoInput.value; fetch(`http://localhost:8080/minus?first=${num_1}&second=${num_2}`) .then(response => response.text()) - .then(res => resultInput.value = res); + .then(res => { + const ru = new Intl.NumberFormat("ru").format(res); + resultInput.value = ru; + }); } buttonMulti.onclick = function(event) { event.preventDefault(); let num_1 = numberOneInput.value; let num_2 = numberTwoInput.value; + fetch(`http://localhost:8080/multi?first=${num_1}&second=${num_2}`) .then(response => response.text()) - .then(res => resultInput.value = res); + .then(res => { + const ru = new Intl.NumberFormat("ru").format(res); + resultInput.value = ru; + }); } buttonDiv.onclick = function(event) { event.preventDefault(); @@ -33,5 +43,9 @@ buttonDiv.onclick = function(event) { let num_2 = numberTwoInput.value; fetch(`http://localhost:8080/div?first=${num_1}&second=${num_2}`) .then(response => response.text()) - .then(res => resultInput.value = res); - } \ No newline at end of file + .then(res => + { + const ru = new Intl.NumberFormat("ru").format(res); + resultInput.value = ru; + }); +} \ No newline at end of file