|
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Login Form</title>
- </head>
- <body>
- <h1>Login</h1>
- <form id="loginForm">
- <label for="email">Username (Email):</label>
- <input type="text" id="email" name="email" required>
- <br>
- <label for="password">Password:</label>
- <input type="password" id="password" name="password" required>
- <br>
- <button type="button" id="loginButton">Login</button>
- </form>
- <script>
- document.getElementById('loginButton').addEventListener('click', function() {
- const email = document.getElementById('email').value;
- const password = document.getElementById('password').value;
-
- const data = {
- email: email,
- password: password
- };
-
- fetch('https://spt-moduled-symfony.ddev.site:8443/spt-core/api/login', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify(data)
- })
- .then(response => response.json())
- .then(data => {
- console.log(data);
- // Handle the response data as needed
- })
- .catch(error => {
- console.error(error);
- // Handle errors
- });
- });
- </script>
- </body>
- </html>
|