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 + }