-
Notifications
You must be signed in to change notification settings - Fork 3
/
profile.js
38 lines (32 loc) · 934 Bytes
/
profile.js
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
$(document).ready(function() {
$("#myForm").submit(function(event) {
// Prevent default form submission behavior
event.preventDefault();
// Get form data
var formData = {
'Username': $('input[name=Username]').val(),
'age': $('input[name=age]').val(),
'dob': $('input[name=dob]').val(),
'contact': $('input[name=contact]').val(),
'address': $('input[name=address]').val(),
'about': $('input[name=about]').val(),
};
// Send AJAX POST request to signup.php and move to registerpage.html
$.ajax({
type: 'POST',
url: 'profile.php',
data: formData,
dataType: 'json',
encode: true
})
.done(function(data) {
console.log(data);
if (data.success == true) {
window.location.href = 'login.html';
}
else {
alert(data.message);
}
});
});
});