FINALLY FIXED THE UNREAD CHAT MESSAGES!
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
function showNotifications(notifications, id) {
|
||||
$("#" + id).html("");
|
||||
function showFriendNotifications(notifications) {
|
||||
$("#friendrequestslist").html("");
|
||||
for (i in notifications) {
|
||||
$("#" + id).append(" \
|
||||
$("#friendrequestslist").append(" \
|
||||
<li class='friend-item $extraItem'> \
|
||||
<form action='profile.php' method='get'> \
|
||||
<button type='submit' \
|
||||
@@ -18,19 +18,42 @@ function showNotifications(notifications, id) {
|
||||
}
|
||||
}
|
||||
|
||||
function showChatNotifications(notifications) {
|
||||
$("#unreadChatlist").html("");
|
||||
for (i in notifications) {
|
||||
$("#unreadChatlist").append(" \
|
||||
<li class='friend-item $extraItem'> \
|
||||
<form action='chat.php' method='get'> \
|
||||
<button type='submit' \
|
||||
name='username' \
|
||||
value='"+ notifications[i].userID +"'> \
|
||||
<div class='friend'> \
|
||||
<img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \
|
||||
<div class='friend-name'> \
|
||||
"+ notifications[i].name +"<br/> \
|
||||
<span style='color: #666'>"+ notifications[i].content +"</span> \
|
||||
</div> \
|
||||
</div> \
|
||||
</button> \
|
||||
</form> \
|
||||
</li> \
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
function loadNotifications() {
|
||||
$.post(
|
||||
"API/loadFriendRequestNotifications.php"
|
||||
).done(function(data) {
|
||||
if (data && data != "[]") {
|
||||
showNotifications(JSON.parse(data), "friendrequestslist");
|
||||
showFriendNotifications(JSON.parse(data));
|
||||
}
|
||||
});
|
||||
$.post(
|
||||
"API/loadChatNotifications.php"
|
||||
).done(function(data) {
|
||||
if (data && data != "[]") {
|
||||
showNotifications(JSON.parse(data), "unreadChatlist");
|
||||
showChatNotifications(JSON.parse(data));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user