-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.js
73 lines (69 loc) · 2.39 KB
/
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
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
67
68
69
70
71
72
73
$(document).ready(function () {
//Ajax code to update username
//prevent the default action of form
$("#updateusernameform").submit(function (event) {
event.preventDefault();
//Get the value of element from the form
var datatopost = $(this).serialize();
//send the value to php file through Ajax
$.ajax({
url: "updateusername.php",
type: "POST",
data: datatopost,
success: function(data){
if(data){
$("#usernamemessage").html(data);
}
else{
location.reload();
}
},
error: function(){
$("#usernamemessage").html("<div class='alert alert-danger'>There was an error excecuting the Ajax call.</div>");
}
});
});
//Ajax code to update password
//prevent the default action of form
$("#updatepasswordform").submit(function (event) {
event.preventDefault();
//Get the value of element from the form
var datatopost = $(this).serialize();
//send the value to php file through Ajax
$.ajax({
url: "updatepassword.php",
type: "POST",
data: datatopost,
success: function(data){
if(data){
$("#passwordmessage").html(data);
}
},
error: function(){
$("#passwordmessage").html("<div class='alert alert-danger'>There was an error excecuting the Ajax call.</div>");
}
});
});
//Ajax code to update Email
//prevent the default action of form
$("#updateemailform").submit(function (event) {
event.preventDefault();
//Get the value of element from the form
var datatopost = $(this).serialize();
//send the value to php file through Ajax
$.ajax({
url: "updateEmail.php",
type: "POST",
data: datatopost,
success: function(data){
if(data){
$("#updateemailmessage").html(data);
}
},
error: function(){
$("#updateemailmessage").html("<div class='alert alert-danger'>There was an error excecuting the Ajax call.</div>");
}
});
});
});
//Ajax code to update email