On 20 January 2012 19:14, Chris Green cl@isbd.net wrote:
I want to have a button on a web page that executes some code (currently a bash script) but which isn't 'real' CGI in that it doesn't send anything back to the web server. I want nothing at all to happen to the web page when the button is clcked.
Is there some sort of CGI 'output' which does nothing at all?
I suspect you've already found a solution on this, based on your other messages, but for the future there are a number of other ways to do it.
AJAX is perhaps the most obvious, and most complex way, and I suspect overkill for what you're doing.
Alternatively, you could try a hidden iframe;
<body> <form action="test2.html" target="test"> <input type="submit" value="Try me!"> </form>
<iframe name="test"/> </body>
The "target" of the form is "test" - which is the iframe just below it. The iframe will contain the CGI output from your script. When you've done testing, simply add a style="display:none" to the iframe so you can't see the output;
Alternatively, if you don't want any from data submitted, you could simply use a button and some JavaScript;
<input type="button" value="Try me!" onclick="document.getElementById('iFrameId').src='test2.html';"> <iframe id="iFrameId"/>
HTH,
Greg