Paano po to gawin nah push notiifcation po gamitin pero dapat pag mag push ako nang notification ito ang problema koh paano gawin toh nah pag may mag pah booking dapat mah notify yong admin at pag mag update nang status si admin ma notify din si user Paano po pa help huhuhu
function createNotification($user_id, $appointment_id, $status, $message) {
global $db;
PHP Code to Create Notifications
$query = "INSERT INTO notifications (user_id, appointment_id, status, message)
VALUES (?, ?, ?, ?)";
$stmt = $db->prepare($query);
$stmt->bind_param("iiss", $user_id, $appointment_id, $status, $message);
$stmt->execute();
}
AJAX Polling for Notifications
function checkNotifications() {
$.ajax({
url: 'get_notifications.php',
type: 'GET',
success: function(data) {
// Parse the response and show notifications
var notifications = JSON.parse(data);
notifications.forEach(function(notification) {
alert(notification.message); // Show notification to the user
});
}
});
}
function createNotification($user_id, $appointment_id, $status, $message) {
global $db;
PHP Code to Create Notifications
$query = "INSERT INTO notifications (user_id, appointment_id, status, message)
VALUES (?, ?, ?, ?)";
$stmt = $db->prepare($query);
$stmt->bind_param("iiss", $user_id, $appointment_id, $status, $message);
$stmt->execute();
}
AJAX Polling for Notifications
function checkNotifications() {
$.ajax({
url: 'get_notifications.php',
type: 'GET',
success: function(data) {
// Parse the response and show notifications
var notifications = JSON.parse(data);
notifications.forEach(function(notification) {
alert(notification.message); // Show notification to the user
});
}
});
}