I am developing a web application for a router, and I have two buttons, Scan and Reboot in two different pages . The function for scan is to scan all the connected devices and displaying ( using php ), and that for Reboot is to reboot the whole system. I am using openwrt.
I am planning to use a scanning spinner and a rebooting spinner in these pages while it is doing these processes. I got this reference and I tried this but I guess it is not working for the scan and reboot.
So Is there a way to make this work using pure JS. (I got images from this link)
EDIT
Here is my code for reboot page
JS
function spin(){
window.onload=document.getElementById("loading").style.display = "none";
}
CSS
#loading {width: 100%;height: 100%;top: 0px;left: 0px;position: fixed;display: block; z-index: 99}
#loading-image {position: absolute;top: 40%;left: 45%;z-index: 100}
HTML PHP
<body onload="spin();">
<div id="loading">
<img id="loading-image" src="http://jimpunk.net/Loading/wp-content/uploads/loading1.gif" alt="Loading..." />
</div>
<form name="reboot" style="height: 56px;" action="reboot.php" method="post">
<input type="submit" name="reboot" value="Reboot">
</form>
<?php
if (isset($_POST['reboot']))
shell_exec("reboot");
?>