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 anyway

Here 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>

In reply to CGI::Ajax No head/html tags, nowhere to insert. Returning javascript anyway. by msinfo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.