feat: add frontend data reload option

This commit is contained in:
Aliberk Sandıkçı 2024-01-07 16:46:33 +03:00
parent 090cec8242
commit 8772320cb1
Signed by: asandikci
GPG Key ID: 25C67A03B5666BC1
2 changed files with 16 additions and 0 deletions

View File

@ -102,6 +102,17 @@
}, 250);
}
</script>
<script>
function updateData() {
xmlHttp = new XMLHttpRequest();
params = "updateData=yes";
xmlHttp.open("POST", "src/server.php", true);
xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xmlHttp.send(params);
flag = true;
return "UPDATED DATA FROM SERVER!"
}
</script>
<script>
function isSameDay(a, b) {
return a.toDateString() == b.toDateString();

View File

@ -189,3 +189,8 @@ function parseTOML()
$array = $parser::ParseFile(__DIR__ . "/../data.toml");
return $array;
}
if ($_POST['updateData'] != null && $_POST['updateData'] == "yes") {
updateRemoteData();
}