|
|
Q923 How can I run a CGI script by clicking on an image and mapping the cgi script's return value into a javascript variable, all this without loading a new html page?
irt.org | Knowledge Base | JavaScript | Image | Q923 [ previous next ] Q923 How can I run a CGI script by clicking on an image and mapping the cgi script's return value into a javascript variable, all this without loading a new html page?You can invoke a cgi script by clicking on an image by replacing the source of the image:
But, for this to work, the script.cgi must return an image and not text. It is not possible to capture a value returned by a cgi script in this fashion. It is possible to return the results to another frame:
If you've defined the frameset as:
Then the results will be hidden in a hidden frame. If you write the cgi script to return HTML with embedded JavaScript, then you can set capture the result and store it in a JavaScript variable. The CGI script could return HTML as follows:
Feedback on 'Q923 How can I run a CGI script by clicking on an image and mapping the cgi script's return value into a javascript variable, all this without loading a new html page?' |
-- div -->
|