msinfo has asked for the wisdom of the Perl Monks concerning the following question:
hi monks,
i am getting below message in my web pages, which use CGI::Ajax module
No head/html tags, nowhere to insert. Returning javascript anywayHere is skeleton of my code:
my $pjx = new CGI::Ajax( 'exported_func' => \&perl_func); print $pjx->build_html($cgi, \&Show_Html); sub perl_func { # ajax function } sub Show_Html { # html generating code # first check session info print $session->header(); # generate html print $cgi->start_html(); # remaining html code print $cgi->end_html(); }
Now this generates, html properly and even calls Ajax function, but displays above warning message in browser, all the time.
I went through CGI::Ajax documentation, and below are the lines, which I doubt are related to problem. Arguments: The CGI object, and either a coderef, or a string containing html. Optionally, you can send in a third parameter containing information that will get passed directly to the CGI object header() call.
or is it mandatory to write Show_Html as follows only
sub Show_HTML { my $html = <<EOT; <HTML> # html generating code </HTML> EOT return $html; }
While doing debugging with Firefox, I found out that actual response body was as follows
# html generated by Show_Html <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U +S"> <head> <title></title> </html> # and again html generated by cgi::ajax <html> </html>
|
|---|