I write PHP to exec some system command in my Ubutu server. It should be waiting a period and and this time I want show loader waiting. Now, I exec directly, and not use ajax. How can I show show loader during form submit and hide loader when it dones?
Here is my php code:
<?php
if(isset($_POST['check_ip']))
{
$ip = "localhost";
$user = 'root';
$pass = 'letmein';
$connection = ssh2_connect($ip, 22);
ssh2_auth_password($connection,$user,$pass);
$stream = ssh2_exec($connection, 'ifconfig');
stream_set_blocking($stream, true);
print "<pre>".stream_get_contents($stream)."</pre>";
exit;
}
?>
And form HTML:
<div class="col-md-3">
<div class="form-group">
<label style='font-size:15px;color:black'>SHOW IP</label>
<button name="check_ip" type="submit" id="check_ip" class="btn btn-primary btn-fill pull-center" onclick="return confirm('RELLY?')"><b>SHOW IP<b></button>
</div>
</div>