Con Ajax sí puedo retornar un valor o que cargue el contenido en un DIV, pero tengo problemas con las funciones.
Y no quiero utilizar iframe, porque sería superfacil así, jejeje

Obviamente intenté varias cosas que podrán ver ahí, hasta mirando los otros posts, pero nada, no he podido.
Este es mi código.
Using perl Syntax Highlighting
#!/usr/bin/perl -w
use CGI qw(:all);
use CGI::Carp qw(fatalsToBrowser);
use warnings;
use lib('/home/hacienda/perl');
use HTML::GoogleMaps
$map_key ="ABQIAAAAtAMCnHp62uPNmIo29GJPDxTIcsmRybTV2L0onpnxWDriga4vXxRUo05dmh_YS2dEqg25eGEDZhl68g";
#print header;
#print "Content-type: text/javascript\n\n";
$map = HTML::GoogleMaps->new(key => $map_key);
$map->center("3.428829451139014, -76.52620196322468");
#$map->add_icon(name => $icon_name, image => $image_url, shadow => $shadow_url, icon_size => [ $width, $height ], shadow_size => [ $width, $height ], icon_anchor => [ $x, $y ], info_window_anchor => [ $x, $y ]);
$map->v2_zoom(15);
$map->controls("small_zoom_control");
$map->add_icon(name => 'name2',
image => 'http://www.haciendagualcala.com/hostel.jpg',
shadow => 'http://www.haciendagualcala.com/hostel.jpg',
icon_size => [ 50, 50 ],
shadow_size => [ 50, 50 ],
info_window_anchor => [ 10, 10 ],
icon_anchor => [10,10 ]);
$map->add_icon(name => 'name',
image => 'http://www.haciendagualcala.com/aero.jpg',
shadow => 'http://www.haciendagualcala.com/aero.jpg',
icon_size => [ 50, 50 ],
shadow_size => [ 50, 50 ],
info_window_anchor => [ 10, 10 ],
icon_anchor => [10,10 ]);
$map->add_marker(noformat => 1,
point => "3.428829451139014, -76.52620196322468",
html => 'hola mundo',
icon => "name",l);
$map->add_marker(noformat => 1,
point => "3.428789556632, -76.5298055548",
html => 'hola mundo',
icon => "name2",l);
$map->add_polyline(points => [ "3.428829451139014, -76.52620196322468", "3.428789556632, -76.5298055548" ], color=>'#550000');
my ($head, $map_div) = $map->onload_render;
#return ($head, $map_div);
#print "<html>";
#print "<head>";
#print "$head";
#print "</head>";
#print '<body onload="html_googlemaps_initialize()">';
#print $map_div;
#print "</body>";
#print "</html>";
#print ($head);
#exit($head);
$prueba = 1;
$prueba_result = $prueba + 1;
$result = $prueba_result;
print $prueba_result;
exit($result);
use CGI qw(:all);
use CGI::Carp qw(fatalsToBrowser);
use warnings;
use lib('/home/hacienda/perl');
use HTML::GoogleMaps
$map_key ="ABQIAAAAtAMCnHp62uPNmIo29GJPDxTIcsmRybTV2L0onpnxWDriga4vXxRUo05dmh_YS2dEqg25eGEDZhl68g";
#print header;
#print "Content-type: text/javascript\n\n";
$map = HTML::GoogleMaps->new(key => $map_key);
$map->center("3.428829451139014, -76.52620196322468");
#$map->add_icon(name => $icon_name, image => $image_url, shadow => $shadow_url, icon_size => [ $width, $height ], shadow_size => [ $width, $height ], icon_anchor => [ $x, $y ], info_window_anchor => [ $x, $y ]);
$map->v2_zoom(15);
$map->controls("small_zoom_control");
$map->add_icon(name => 'name2',
image => 'http://www.haciendagualcala.com/hostel.jpg',
shadow => 'http://www.haciendagualcala.com/hostel.jpg',
icon_size => [ 50, 50 ],
shadow_size => [ 50, 50 ],
info_window_anchor => [ 10, 10 ],
icon_anchor => [10,10 ]);
$map->add_icon(name => 'name',
image => 'http://www.haciendagualcala.com/aero.jpg',
shadow => 'http://www.haciendagualcala.com/aero.jpg',
icon_size => [ 50, 50 ],
shadow_size => [ 50, 50 ],
info_window_anchor => [ 10, 10 ],
icon_anchor => [10,10 ]);
$map->add_marker(noformat => 1,
point => "3.428829451139014, -76.52620196322468",
html => 'hola mundo',
icon => "name",l);
$map->add_marker(noformat => 1,
point => "3.428789556632, -76.5298055548",
html => 'hola mundo',
icon => "name2",l);
$map->add_polyline(points => [ "3.428829451139014, -76.52620196322468", "3.428789556632, -76.5298055548" ], color=>'#550000');
my ($head, $map_div) = $map->onload_render;
#return ($head, $map_div);
#print "<html>";
#print "<head>";
#print "$head";
#print "</head>";
#print '<body onload="html_googlemaps_initialize()">';
#print $map_div;
#print "</body>";
#print "</html>";
#print ($head);
#exit($head);
$prueba = 1;
$prueba_result = $prueba + 1;
$result = $prueba_result;
print $prueba_result;
exit($result);
Coloreado en 0.004 segundos, usando GeSHi 1.0.8.4
Deseo retornar $head y $map_div como dos variables aparte a mi código PHP,
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Sin título 1</title>
- <script type="text/javascript" src="isiAJAX.js"></script>
- <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAtAMCnHp62uPNmIo29GJPDxTIcsmRybTV2L0onpnxWDriga4vXxRUo05dmh_YS2dEqg25eGEDZhl68g" type="text/javascript"></script>
- <script language="javascript" src="map.pl"></script>
- <?
- exec ("maps.pl", $salida, $return);
- //print ($salida);
- $result_search = system("maps.pl",$result);
- print $result.$result_search;
- ?>
- </head>
- <body onload="html_googlemaps_initialize();"/>
- <a href="javascript:;" onclick=" html_googlemaps_initialize();">CLICch here</a>
- <a href="javascript:myajax.Link('maps.pl', 'map3')" onclick="">CLICch here</a>
- <div id="map" style="width:600px;" >
- </div>
- <a href="javascript:myajax.Link('maps.pl', 'map')" onclick="">CLICch here</a>
- <a href="javascript:;" onclick=" html_googlemaps_initialize();">CLICch here</a>
- </body>
- </html>
Hasta quise usar el cgi como un script JavaScript, pero tampoco.