Genera un formulario en JavaScript y html para el login
- User
Genera un formulario en JavaScript y html para el login
Assistant
Sure, here's an example of a login form in JavaScript and HTML:
JavaScript:
codefunction login(email, password) { // Check if the email and password are valid if (email.length < 3 || password.length < 3) { alert("Incorrect email or password"); return false; } // Create the login form var form = document.getElementById("login-form"); // Add an input field for the email and password form.addElement("input", "email", email); form.addElement("input", "password", password); // Add an "OK" button form.addElement("button", "submit", function() { // Submit the form using AJAX $.ajax({ type: "POST", url: "login.php", data: $(form).serialize(), success: function(response) { console.log(response); } }); }); }