Menu, netjes, notification

This commit is contained in:
Lars van Hijfte
2017-01-23 16:24:48 +01:00
parent 1ec8de71f0
commit 58ce5f1e75
11 changed files with 114 additions and 104 deletions

View File

@@ -1,7 +1,7 @@
function showNotifications(notifications, id) {
$("#friendrequestslist").html("");
$("#" + id).html("");
for (i in notifications) {
$("#friendrequestslist").append(" \
$("#" + id).append(" \
<li class='friend-item $extraItem'> \
<form action='profile.php' method='get'> \
<button type='submit' \
@@ -20,15 +20,25 @@ function showNotifications(notifications, id) {
function loadNotifications() {
$.post(
"API/loadNotifications.php"
"API/loadFriendRequestNotifications.php"
).done(function(data) {
if (data && data != "[]") {
showNotifications(JSON.parse(data), "friendrequestslist");
}
});
$.post(
"API/loadChatNotifications.php"
).done(function(data) {
if (data && data != "[]") {
showNotifications(JSON.parse(data), "unreadChatlist");
}
});
setTimeout(loadNotifications, 10000);
}
$(document).ready(function() {
loadNotifications();
});
loadNotifications();