-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
36 lines (30 loc) · 1.1 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Find forms on the page
const formEl = document.getElementById("apiform")
formEl.addEventListener('submit', submitRequest);
// Find the box alert
const alertEl = document.getElementById("boxalert");
function submitRequest(e) {
e.preventDefault();
$("#boxalert").show();
alertEl.style['display'] = 'block';
formEl.style.cssText = 'filter: blur(8px); -webkit-filter: blur(8px);'
const formData = new FormData(formEl);
const url = "https://rapihs.dhruvtuteja.tech/heart_stroke?";
fetch(url + new URLSearchParams(formData), {
method: "GET",
// })
}).then(
response => response.json().then(function (text) {
// do something with the text response
console.log(text)
if (text[0] === "[1]") {
document.getElementById("boxtext").innerHTML = "Patient will get stroke";
}
else
document.getElementById("boxtext").innerHTML = "Patient will not get stroke";
})
)
}
document.getElementById("myBtn").addEventListener("click", function () {
formEl.style.cssText = ""
});