I have a button on my page that executes a .sh script which writes to connection_check.txt. The issue I’m running into is that after the script has ran, the old version/data is still shown on the page as it doesn’t seem the page gets fully refreshed after the .sh has ran so the old data is still cached. Or maybe its because I have $_SESSION set because apart from write to a file, the .sh also echos a value that unhides the divs.
I’m very unfamiliar with html and php. My div looks like this.
<div class="connection_details" id="connection_details_id" style="display:none;">
<p><?php include('connection_check.txt'); ?></p>
</div>
I also tried adding this to no avail..
<?php if ($output1 == 1) : ?>
<script>
document.getElementById("connection_details_id").style.display = "block";
</script>
$("#connection_details_id").load(location.href + " #connection_details_id");
<?php endif ?>
How can I make sure connection_check.txt is retrieved again after running the .sh and changing style.display to block??
2
Answers
Found a solution myself.
Might not be pretty but it works.
I’m not sure, How do you run the .sh script, However run the following code after you run it
Also, take a look at AJAX