| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Document</title>
- </head>
- <body>
- <form
- action=""
- style="display: flex; flex-direction: column; width: 200px; gap: 10px"
- >
- <input type="text" name="username" placeholder="Username" />
- <input type="password" name="password" placeholder="Password" />
- <input type="text" name="captcha" placeholder="Captcha" />
- <img
- src="https://api.danjiwanjia.com/admin/getAdminCaptchaImage"
- alt="Captcha"
- />
- <button type="submit">Submit</button>
- </form>
- </body>
- <script>
- const form = document.querySelector("form");
- form.addEventListener("submit", async (e) => {
- e.preventDefault();
- const formData = new FormData(form);
- const data = Object.fromEntries(formData.entries());
- console.log(data);
- const res = await fetch("https://api.danjiwanjia.com/admin/login", {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify(data),
- });
- const result = await res.json();
- console.log(result);
- });
- </script>
- </html>
|