Sorry it is unclear. I have something kind of working,but not really working. When I click on the Update button, I see my post appear on the screen (ie., healthchk.cgi?fname=displayText&args=Update&update=Update) for a second and then it flashes off the screen instead of the text I was expecting from the &displayText function.
Here is part of the code:
#!/usr/opt/perl5/bin/perl -Tw
use CGI;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use CGI::Ajax;
use strict;
use warnings;
use English;
use Env qw(PATH IFS CDPATH EMV BASH_EMV);
$ENV{PATH} = "/bin:/usr/bin:/usr/local/AppAdmin/healthchk/bin:/usr/loc
+al/healthchk/bin";
delete @ENV{ 'IFS', 'CDPATH', 'ENV', 'BASH_ENV' };
my $home = "/usr/local/AppAdmin/healthchk";
my $html = "";
my $cgi = CGI->new();
my $ajax = CGI::Ajax->new(displayText => \&displayText );
$ajax->JSDEBUG(1);
print $ajax->build_html($cgi,\&main);
sub main() {
$html = <<HTML;
<html>
<head>
<title>Siebel HealthCheck</title>
<LINK href="/healthchk/style.css" rel="stylesh
+eet" type="text/css">
</head>
<body>
<table class="banner" border="0" cellspacing="0" cellp
+adding="0" bgcolor="#000000">
<tr valign="top">
<td class="banner" width="10%">
<img src="/healthchk/images/bc
+bsnc.gif" width="100%" >
</td>
<td class="banner" width="80%">
</td>
<td class="banner" width="10%">
<font align="right" size="1px"
+ color=white>© 2007 David Shapiro</p></font>
</td>
</tr>
</table>
<h1>Siebel HealthCheck</h1>
HTML
# Do something
print_response() if $cgi->param;
my $url = $cgi->url(-relative => 1);
$html .= <<HTML;
<form action="$url" method="post">
<center>
Environment
<input type="checkbox" class="cbox" name="envi
+ronment" value="ALL" > ALL
<input type="checkbox" class="cbox" name="envi
+ronment" value="prod"> prod
<input type="checkbox" class="cbox" name="envi
+ronment" value="pstage"> pstage
<input type="checkbox" class="cbox" name="envi
+ronment" value="qa"> qa
<input type="checkbox" class="cbox" name="envi
+ronment" value="dev"> dev
<input type="checkbox" class="cbox" name="envi
+ronment" value="pmt"> pmt
<input type="checkbox" class="cbox" name="envi
+ronment" value="sand"> sand
<br><br><input type="submit" value="Submit" cl
+ass="btn">
<input type="submit" id="update" onClick="disp
+layText(['update'],['displayDiv']);" value="Update" class="btn"><br><
+br>
</center>
</form>
<div id="displayDiv"></div>
</body>
</html>
HTML
return $html;
}
sub displayText() {
my $text = shift;
$html .= <<HTML;
<h2>Updating status...</h2>
HTML
return;
}
|