otp-space / templates /index.html
0vergeared's picture
Update templates/index.html
0883572 verified
raw
history blame contribute delete
726 Bytes
<!DOCTYPE html>
<html>
<head><title>OTP Validator</title></head>
<body>
<h2>๐Ÿ” OTP Validator</h2>
<form id="otp-form">
<input type="text" name="otp" placeholder="Enter OTP" required />
<button type="submit">Validate</button>
</form>
<div id="result"></div>
<script>
document.getElementById("otp-form").onsubmit = async (e) => {
e.preventDefault();
const otp = e.target.otp.value;
const res = await fetch("/validate", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({otp}),
});
const data = await res.json();
document.getElementById("result").innerText = data.message;
};
</script>
</body>
</html>