-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.html
More file actions
62 lines (60 loc) · 1.8 KB
/
Copy pathtext.html
File metadata and controls
62 lines (60 loc) · 1.8 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form id="loginForm">
<div>
<label for="username">Username</label>
<input type="text" name="" id="userName">
</div>
<br>
<div>
<label for="password">Password</label>
<input type="password" name="" id="passWord">
</div>
<br>
<button type="submit" id="button">Login</button>
</form>
<script>
const logForm = {
email:document.querySelector("#userName"),
password: document.querySelector("passWord"),
submit: document.querySelector("#button")
};
let button = logForm.submit.addEventListener("click", (e) => {
e.preventDefault();
const login = http;
fetch(login, {
method: "POST",
headers: {
Accept: "application/json, text/plain, */*",
"content-Type": "application/json",
},
body: JSON.stringify({
email: logForm.email.value,
password: logForm.password.value,
}),
})
.then((Response) => Response.json())
.then((data) => {
console.log(data)
if(dat.error){
alert("Error Occur")
}else{
window.open(
"booking.html"
);
}
})
.catch((err) => {
console.log(err)
});
});
</script>
</body>
</html>