const data = {username: "johndoe", action: "logout"};
const url = "/log.php";
const successCallback = function () {
console.log("Data sent successfully.");
};
const errorCallback = function () {
console.error("Error sending data.");
};
navigator.sendBeacon(url, JSON.stringify(data));