Click to See Complete Forum and Search --> : Calling CGI script from Java script


aztech4mac
08-12-2003, 01:33 PM
I have a CGI script that I need user confirmation before calling. I use a jave script to ask user to verify before executing the CGI. How can I call the CGI from within my java script. Here's my script.

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function drawAlert () {
var agree=confirm("Are you sure you want to clear Guest Book Log. OK?");
if (agree)
<-- CALL CGI HERE -->
else
javascript:rld();
}
// End -->
</script>

pyro
08-12-2003, 01:37 PM
Try this:

<script type="text/javascript">
function drawAlert () {
var agree=confirm("Are you sure you want to clear Guest Book Log. OK?");
if (agree) {
window.location.href = "someapp.cgi";
else {
javascript:rld();
}
}
</script>

aztech4mac
08-12-2003, 02:05 PM
Worked like a charm Thank You!

pyro
08-12-2003, 02:09 PM
You're welcome... :)