I’ve got an easy php script :
<?php
$command = "git pull";
$output = shell_exec($command);
echo "<pre>$output</pre>";
?>
And I want to call it by pressing button :
<form metod="post" action="/pull.php">
<button type="submit">Pull changes</button>
</form>
And I want to get output right under the button or replace button with output but I don’t want to go to /pull.php I just want to run script and get output. How can I make it ?
You need to use javascript’s XMLHTTPRequest (or better yet jQuery’s get), in either case JavaScript will let you load content dynamically from another url.