new
parent
e2d07d872d
commit
a6987e5e40
@ -1,19 +0,0 @@
|
|||||||
// TO SWITCH BETWEEN STATUSES FROM ONLINE TO OFFLINE
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
|
||||||
document.getElementById('goOnlineButton').addEventListener('click', function () {
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
// Access the URL from the data attribute
|
|
||||||
var url = this.getAttribute('data-url');
|
|
||||||
xhr.open('GET', url, true);
|
|
||||||
xhr.onload = function () {
|
|
||||||
if (xhr.status === 200) {
|
|
||||||
// If the request is successful, reload the top window
|
|
||||||
window.top.location.reload();
|
|
||||||
} else {
|
|
||||||
console.log("You are still offline.")
|
|
||||||
}
|
|
||||||
};
|
|
||||||
xhr.send();
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Reference in New Issue