Spaces:
Sleeping
Sleeping
Delete otp_request.js
Browse files- otp_request.js +0 -37
otp_request.js
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
|
2 |
-
document.getElementById("otpForm").addEventListener("submit", async function(event) {
|
3 |
-
event.preventDefault();
|
4 |
-
|
5 |
-
// Capture form values
|
6 |
-
const isd_code = document.getElementById("isd_code").value;
|
7 |
-
const phone = document.getElementById("phone").value;
|
8 |
-
const tenant_id = document.getElementById("tenant_id").value;
|
9 |
-
const product_id = document.getElementById("product_id").value;
|
10 |
-
|
11 |
-
// Construct API payload
|
12 |
-
const payload = {
|
13 |
-
isd_code: isd_code,
|
14 |
-
phone: phone,
|
15 |
-
tenant_id: parseInt(tenant_id),
|
16 |
-
product_id: parseInt(product_id)
|
17 |
-
};
|
18 |
-
|
19 |
-
try {
|
20 |
-
// Send POST request to the API
|
21 |
-
const response = await fetch("https://otp.infinitylearn.com/api/getGatewayOtp", {
|
22 |
-
method: "POST",
|
23 |
-
headers: {
|
24 |
-
"Content-Type": "application/json"
|
25 |
-
},
|
26 |
-
body: JSON.stringify(payload)
|
27 |
-
});
|
28 |
-
|
29 |
-
// Parse JSON response
|
30 |
-
const data = await response.json();
|
31 |
-
|
32 |
-
// Display the response in the preformatted section
|
33 |
-
document.getElementById("response").textContent = JSON.stringify(data, null, 2);
|
34 |
-
} catch (error) {
|
35 |
-
document.getElementById("response").textContent = "Error: " + error.message;
|
36 |
-
}
|
37 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|