feat: add frontend data reload option

This commit is contained in:
asandikci 2024-01-07 16:46:33 +03:00
parent 090cec8242
commit 8772320cb1
No known key found for this signature in database
GPG key ID: 25C67A03B5666BC1
2 changed files with 16 additions and 0 deletions

View file

@ -102,6 +102,17 @@
}, 250); }, 250);
} }
</script> </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> <script>
function isSameDay(a, b) { function isSameDay(a, b) {
return a.toDateString() == b.toDateString(); return a.toDateString() == b.toDateString();

View file

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