-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpostForm.js
More file actions
35 lines (32 loc) · 900 Bytes
/
Copy pathpostForm.js
File metadata and controls
35 lines (32 loc) · 900 Bytes
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
function userPin(pin) {
var text = "231203";
console.log(pin);
if (pin == text) {
//window.location.assign('https://youtube.com');
}
}
function postData() {
fetch(window.location.href, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({pin: document.getElementById("pinNo").value}),
}).then(raw => raw.json())
.then(data => {
console.log(data);
if (data.pin != -1) {
window.location.href = window.location.origin + `/nextpage?id=${data.id}`;
}
})
.catch(e => {});
}
/*document.getElementById("pinNo")
.addEventListener('keyup', function(event) {
if (event.code === "Enter") {
pin = document.getElementById('pinNo').value;
console.log(pin);
userPin(pin);
}
});
*/