-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew_user.html
More file actions
66 lines (56 loc) · 1.98 KB
/
new_user.html
File metadata and controls
66 lines (56 loc) · 1.98 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Registration</title>
<script src="https://code.jquery.com/jquery-3.6.4.min.js" crossorigin="anonymous"></script>
<script>
$(document).ready(function () {
$('#submitBtn').on('submit', function (e) {
e.preventDefault();
const formData = {
first_name: $('#first_name').val(),
last_name: $('#last_name').val(),
phone: $('#phone').val(),
password: $('#password').val(),
email: $('#email').val(),
avatar: $('#avatar').val()
};
$.ajax({
url: 'new_user.php', // Adjust the URL if needed
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(formData),
success: function (result) {
alert('User registered successfully!');
console.log(result);
},
error: function (xhr, status, error) {
alert('An error occurred: ' + xhr.responseText);
console.log(error);
}
});
});
});
</script>
</head>
<body>
<h1>User Registration</h1>
<form id="submitBtn" >
<label for="password">password:</label>
<input type="password" id="password" name="password" required><br><br>
<label for="first_name">First Name:</label>
<input type="text" id="first_name" name="first_name" required><br><br>
<label for="last_name">Last Name:</label>
<input type="text" id="last_name" name="last_name" required><br><br>
<label for="phone">Phone:</label>
<input type="text" id="phone" name="phone" required><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" ><br><br>
<label for="avatar">Avatar URL:</label>
<input type="url" id="avatar" name="avatar"><br><br>
<button type="submit">Submit</button>
</form>
</body>
</html>