new changes.

main
nataly 1 year ago
parent 61e703d343
commit c26cbd224c

@ -21,7 +21,7 @@
<p class="text-secondosiblue text-[18px]">You are Currently Offline</p> <p class="text-secondosiblue text-[18px]">You are Currently Offline</p>
</div> </div>
<button id="goOnlineButton" <button id="goOnlineButton" data-url="{% url 'go_online' %}"
class="w-full text-white bg-green-700 py-3 px-3 rounded-b-md hover:bg-opacity-60 duration-300 cursor-pointer">Go class="w-full text-white bg-green-700 py-3 px-3 rounded-b-md hover:bg-opacity-60 duration-300 cursor-pointer">Go
Online</button> Online</button>
</div> </div>

@ -26,7 +26,7 @@
<p class="text-secondosiblue text-[18px]">You are Currently Offline</p> <p class="text-secondosiblue text-[18px]">You are Currently Offline</p>
</div> </div>
<button id="goOnlineButton" <button id="goOnlineButton" data-url="{% url 'go_online' %}"
class="w-full text-white bg-green-700 py-3 px-3 rounded-b-md hover:bg-opacity-60 duration-300 cursor-pointer">Go class="w-full text-white bg-green-700 py-3 px-3 rounded-b-md hover:bg-opacity-60 duration-300 cursor-pointer">Go
Online</button> Online</button>
</div> </div>

@ -3,7 +3,9 @@
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
document.getElementById('goOnlineButton').addEventListener('click', function () { document.getElementById('goOnlineButton').addEventListener('click', function () {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('GET', "{% url 'go_online' %}", true); // Access the URL from the data attribute
var url = this.getAttribute('data-url');
xhr.open('GET', url, true);
xhr.onload = function () { xhr.onload = function () {
if (xhr.status === 200) { if (xhr.status === 200) {
// If the request is successful, reload the top window // If the request is successful, reload the top window
@ -14,4 +16,4 @@ document.addEventListener('DOMContentLoaded', function () {
}; };
xhr.send(); xhr.send();
}); });
}); });

Loading…
Cancel
Save