OneDreamCloser 1 Newbie Poster

hello all,

today i am trying to write my first CGI program. so i have a HTML page, a JavaScript program that both work just fine when i run them locally.
so, the next step is to run it on an Apache server (locally on MacOSX) and the first example would be the "Hello World" that also works fine.

the problem is when i am trying to display "Content-type: text/html"
what i have written is :

#!/usr/bin/perl -wT

use     strict ;
use     warnings ;
use     diagnostics ;
use     CGI ;
use     CGI::Ajax ;

print "Content-type: text/html \n\n";


sub initialize_html 
{
    my  $html   =   <<HTML ;
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <style type="text/css">
        html    { height: 100% }
        body    { height: 100%; margin: 0px; padding: 0px }
        label   { font-size:9px; text-align:center; color:#222; text-shadow:0 0 5px #fff; font-family:Helvetica, Arial, sans-serif; }
      #map_canvas { height: 100% }
    </style>
    <title>Network Weathermap | hellas online</title>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="js/network_weathermap.js"></script>
</head>
<body>
    <div id="map_canvas"></div>
</body>
</html>
HTML
    print $html . "\n" ;
}

#initialize_html() ;
sub parameterize_info_window
{
    return  "CGI \n" ;
}

my $cgi     =   new CGI() ;
my $ajax    =   new CGI::Ajax( describeInfoWindow   =>  \&parameterize_info_window) ;

print   $ajax->build_html($cgi, \&initialize_html) ;
$ajax->JSDEBUG( 1 ) ;

and returns : "No head/html tags, nowhere to insert. Returning javascript anyway"

how can i overcome this problem ? what is the cause of it ?

thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.