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?
Chris Green 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?
In Naaardge ATM, so haven't any books to hand, but I recommend 'HTML in easy steps' - takes in html4 strict and html4 loose.
But yes, You can put any number of buttons on, and if you don't want the page to be affected (depending on what you tell the button to do, of course) it will execute the function assigned to it. <phone home, ET>
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
On Tue, Jan 24, 2012 at 02:04:59PM +0000, Greg Thomas wrote:
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"/>
What I have actually done is to implement a link to CGI script that does what I want and then does:-
echo Status: 204 No Change echo