From ec9241c098feacb562d0ad7638c3358263517e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D0=BA=D0=BE=D0=B2=D0=B5=D0=BD=D0=BA=D0=BE=20=D0=9C?= =?UTF-8?q?=D0=B8=D1=85=D0=B0=D0=B8=D0=BB?= Date: Wed, 11 Apr 2018 12:52:55 +0300 Subject: [PATCH] Update Solution.js --- MyFirstWeb/src/main/webapp/Solution.js | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/MyFirstWeb/src/main/webapp/Solution.js b/MyFirstWeb/src/main/webapp/Solution.js index 5b704e3..8afce5d 100644 --- a/MyFirstWeb/src/main/webapp/Solution.js +++ b/MyFirstWeb/src/main/webapp/Solution.js @@ -1,5 +1,6 @@ - function square_solution() { - var a = document.table.A.value; + + $(document).ready(function () { + var a = document.table.A.value; var b = document.table.B.value; var c = document.table.C.value; @@ -9,25 +10,6 @@ C: c }; var json = JSON.stringify(coeff); - /* - var xhr = new XMLHttpRequest(); - xhr.open("POST", '/solution', true) - xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8'); - xhr.onreadystatechange =function () { - // встраиваем функцию проверки статуса нашего запроса - // это вызывается при каждом изменении статуса - if (httpRequest.readyState === 4 && httpRequest.status === 200) { - callback.call(httpRequest.responseXML); // вызываем колбек - } - } - xhr.send(json); - var solution = document.getElementById("square_solution"); - var response = xhr.getAllResponseHeaders(); - solution.innerHTML = response;*/ - -} - - $(document).ready(function () { $('#form').submit((event) => { $.ajax({ url: 'http://localhost:8081/solution', @@ -41,4 +23,4 @@ } }) } - } \ No newline at end of file + }