What I have done so far is a PHP code which is running when the page is refreshed:
<?php
$pageRefreshed = isset($_SERVER['HTTP_CACHE_CONTROL']) && $_SERVER['HTTP_CACHE_CONTROL'] === 'max-age=0';
if($pageRefreshed) {
$file01 = file_get_contents("file01.txt");
$path = "file02.txt";
$file02= file_get_contents($path);
if ($file01!== $file02){
file_put_contents($path, $file01);
}
}
?>
but, I have an HTML button:
<button class="btn" id="refreshPanel" onclick="refresh_panel()">Refresh Panel</button>
and I want to copy the content of file01
into file02
if this button is clicked using pure javascript.
Both files and .html and .js files stored in the same folder in my computer.
Thanks for your help and time in advance!