Salve monges,<br><br> estou fazendo algumas coisas simples com o CGI::Ajax, mas estou tendo um problema.<br> No codigo abaixo, quando digito o nome alex, mostro a mensagem, ai foi facil. <br> Mas o que eu preciso fazer e redirecionar para outra pagina quando digito errado, no exemplo, simplesmente mostrei o texto, mas precisava redirecionar.
<br><br> Alguem tem alguma ideia?<br><br>Obrigado a todos<br><br><code><br>use strict;<br>use CGI;<br>use CGI::Ajax;<br><br>my $cgi = new CGI;<br><br>my $ex_verifica = sub {<br> my $nome = shift || undef;<br>
<br> if ($nome eq 'alex') {<br> return "OI $nome";<br> } else {<br> return "DIRECIONA PARA x.pl?n=$nome";<br> }<br>};<br><br>my $inicial = sub {<br><br> my $html =<<EOF;
<br> <html><br> <head></head><br> <body><br> DIGITE SEU NOME: <input type="text" name="nome" id="nome"><br><br> <input value="envia" type="button" id="bt" onClick="verifica(['nome'],['div_msg']);"><br>
<br> <div id="div_msg"></div><br> </body><br> </html><br>EOF<br><br> return $html;<br>};<br><br>my $pjx = CGI::Ajax->new( 'verifica' => $ex_verifica);
<br>print $pjx->build_html($cgi,$inicial); # this outputs the html for the page<br><br></code><br clear="all"><br>-- <br><br>______________________________<br> Alex Falcão