I'm working on a website to show hotel location/information for flight
crews. The hotels/airport codes are being continuously input into a
database. The website is
http://www.bobsonlineworld.net/mycrewguide/bobmain.asp.
The information/maps only load when the user chooses a city or airport
from the dropdown menus.
Other than the original homepage, everything is loaded with an ajax
function. I am finally able to get a map to show up, but I'm having
to hard code the location into the initialize() function. Is there a
way to pass the airport code through when the page is loaded through
the ajax function?
Here is some of the code:
Function to load the page:
unction showLayover(airCode){
if (airCode.length==null)
{
document.getElementById("main").innerHTML="";
return;
}
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="scripts/layoversBody.asp";
url=url+"?AC="+airCode;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("main").innerHTML=xmlHttp.responseText;
eval(initialize());
}
}
Function to load the map (currently hard coded with Denver's airport
code):
var map = null;
var geocoder = null;
function initialize(acode) {
if (GBrowserIsCompatible()) {
geocoder = new GClientGeocoder();
map = new google.maps.Map2(document.getElementById
("map_canvas"));
if (geocoder) {
geocoder.getLatLng(
"DEN",
function(point) {
if (!point) {
alert("DEN" + " not found");
} else {
map.setCenter(point, 9);
var marker = new GMarker(point);
map.addOverlay(marker);
var mapControl = new GMapTypeControl();
map.addControl(mapControl);
map.addControl(new GSmallMapControl());
}
}
);
}
}
}
This code is all in an external javascript file.
I'm wanting to use the geocoder so I don't have to find the latitude
and longitude for each airport.
Is there anything I can do?
Sorry for the super long post, but I'm new here and to the Google API
and I wanted to give you guys as much info as possible.
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---