تخطي إلى المحتوى الرئيسي
// Add after existing notification scripts
function loadMoreNotifications() {
const container = document.getElementById('notifications-container');
const currentPage = parseInt(container.dataset.page);
fetch(`/seraj/api/get_notifications.php?page=${currentPage + 1}&limit=5`)
.then(response => response.json())
.then(data => {
if (data.notifications.length > 0) {
container.dataset.page = currentPage + 1;
data.notifications.forEach(notification => {
// Append new notifications
const notificationElement = createNotificationElement(notification);
container.appendChild(notificationElement);
});
}
if (data.notifications.length < 5) { document.querySelector('.load-more-notifications').style.display='none' ; }
}); } document.querySelector('.load-more-notifications')?.addEventListener('click', loadMoreNotifications);