Files
NetAlertX/front/js/tests.js
2024-06-03 07:39:27 +10:00

33 lines
798 B
JavaScript
Executable File

// --------------------------------------------------
// Check if database is locked
function lockDatabase(delay=20) {
$.ajax({
url: 'php/server/dbHelper.php', // Replace with the actual path to your PHP file
type: 'GET',
data: { action: 'lockDatabase', delay: delay },
success: function(response) {
console.log('Executed');
},
error: function() {
console.log('Error ocurred');
}
});
let times = delay;
let countdownInterval = setInterval(() => {
times--;
console.log(`Remaining time: ${times} seconds`);
if (times <= 0) {
clearInterval(countdownInterval);
console.log('Countdown finished');
}
}, 1000);
}