Skip to content

Commit e27825a

Browse files
authored
Adding new reload method (beta)
1 parent 3340e9b commit e27825a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

project/js/loading.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
1+
/*
12
let loading = document.querySelector(".loading-wrapper");
23
window.onload = function () {
34
setTimeout(function () {
45
loading.style.display = "none";
56
}, 2000);
67
};
8+
*/
9+
10+
load("https://functionalty.netlify.app/");
11+
function load(url) {
12+
// displaying loading screen
13+
document.querySelector(".loading-wrapper").visible = true;
14+
// request the data
15+
var req = new XMLHttpRequest();
16+
req.open("POST", url, true);
17+
18+
req.onreadystatechange = function () {
19+
if (req.readyState == 4 && req.status == 200) {
20+
// content is loaded
21+
if (req.responseText) {
22+
document.querySelector("body").innerHTML = req.responseText;
23+
document.querySelector(".loader-wrapper").visible = false;
24+
}
25+
}
26+
}
27+
request.send(vars);
28+
}

0 commit comments

Comments
 (0)