-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
50 lines (47 loc) · 1.51 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document Uploader</title>
</head>
<body>
<form action="/submit" method="post" enctype="multipart/form-data" onsubmit="submitForm(event)">
<label for="documentType">Document Type:</label>
<select id="documentType" name="documentType">
<option value="10th">10th</option>
<option value="12th">12th</option>
</select>
<br>
<label for="documentImage">Document Image:</label>
<input type="file" id="documentImage" name="documentImage" accept="image/*">
<br>
<button type="submit">Submit</button>
</form>
<div id="result"></div>
<script>
function submitForm(event) {
event.preventDefault();
const form = event.target;
// Submit the form using fetch
fetch(form.action, {
method: form.method,
body: new FormData(form),
})
.then(response => response.json())
.then(data => {
// Display the result on the webpage
if(data.verdict!= true && data.verdict!= false){
const resultElement = document.getElementById('result');
resultElement.textContent = `Document is Pending`;
}
else {
const resultElement = document.getElementById('result');
resultElement.textContent = `Document is ${data.verdict ? 'authentic' : 'forged'}`;
}
})
.catch(error => console.error('Error:', error));
}
</script>
</body>
</html>