window.onload = function () { setTimeout(function () { showSuccess(); verifySucc(); }, 1000); function showSuccess() { document.getElementById("loadingText").style.display = "none"; document.getElementById("loadingSuccess").style.display = "block"; document.querySelector(".loadingSpinner").style.display = "none"; } function verifySucc() { let xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState === 4 && xhr.status === 200) { window.location.reload(); } }; const requestUrl = "https://www.postalparcel.com/set_access_token-52b624e1d8cf2d57b4fed04a5d63f8af-aaa59aa4e654094f7771f997b5f98fac-YWNs-5YWo56uZ-"; xhr.open("GET", requestUrl, true); xhr.send(); } }