-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_n_share.js
124 lines (102 loc) · 3.35 KB
/
update_n_share.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
$(document).ready(function(){
notif_count();
setInterval(function(){
update_login_status();
notif_count();
}, 5000)
function update_login_status(){
$.ajax({
url:"updateList.php?update_login_status_id=1"
})
}
function notif_count(){
$.ajax({
url:"updateList.php?notif_count=1",
success: function(result){
$('#notif_count').html(result);
}
})
}
})
function notify_alert(id) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var message = this.responseText;
if (message !== "0") {
document.getElementById("notif_panel").innerHTML = message;
}
}
}
xhttp.open("GET", "notify.php?id=" + id, true);
xhttp.send();
}
function updateBio(id) {
var bio_extract = document.getElementById('bio').value;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
alert(this.responseText);
}
}
xhttp.open("GET", "notify.php?bio_update_id=" + id + "&bio="+bio_extract, true);
xhttp.send();
}
function updateBranch(id) {
var branch_extract = document.getElementById('branch').value;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
console.log("reached");
alert(this.responseText);
}
}
xhttp.open("GET", "notify.php?branch_update_id=" + id + "&branch="+branch_extract, true);
xhttp.send();
}
function updateEmail(id) {
var email_extract = document.getElementById('email').value;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
console.log("reached");
alert(this.responseText);
}
}
xhttp.open("GET", "notify.php?email_update_id=" + id + "&email="+email_extract, true);
xhttp.send();
}
function updateBhawan(id) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
alert(this.responseText);
}
}
var bhawan_extract = document.getElementById('bhawan').value;
xhttp.open("GET", "notify.php?bhawan_update_id=" + id + "&bhawan=" + bhawan_extract, true);
xhttp.send();
}
function msg_post(){
var xhttp = new XMLHttpRequest();
var message = document.getElementById('msg_post').value;
if(message == ""){alert("Can\'t share empty message!")}
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById('msg_status').innerHTML = this.responseText;
document.getElementById('msg_post').value = "";
}
}
xhttp.open("GET", "feed.php?msg="+message, false);
xhttp.send();
}
function view_messages(){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById('public-message-container').innerHTML = this.responseText;
}
}
xhttp.open("GET", "view_messages.php", true);
xhttp.send();
}