Hi Google super programmers!
I was running some code yesterday. It was working really well (using
Firefox). Then I went home and tried it and I started getting parse
errors and no markers showing up. I don't know why. Today I thought I
would try it on IE and I don't get the parse errors. Any help would be
appreciated!
Here is the code
<html>
<head>
<script type="text/javascript" src="http://www.google.com/
jsapi?key=ABQIAAAAXGp-
Wh7RXs1hPKr-7RuuSxTmrZ1BxykKkHNFRnXTFIyBz45ssBTaMI3cqdUcYN1sGvEQiRTn8kLpYg"></
script>
<script type="text/javascript">
google.load("jquery", '1.3');
google.load("maps", "2.x");
var map;
</script>
<script type="text/javascript" charset="utf-8">
<!-- This is the initialize function. This sets up a map. It is
called when the body finishes loading-->
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(35.67419,139.708736), 2);
geocoder = new GClientGeocoder();
map.addControl(new GSmallMapControl());
map.addControl(new GMap2TypeControl());
}
}
<!-- This is the showAddress function. It takes a place name (like
Tokyo) and displays it on the map -->
function showAddress(address, text) {
var geocoder = new GClientGeocoder();
geocoder.getLatLng(
address,
function(point) {
if (!point) {
} else {
map.setCenter(point, 1);
var marker = new GMarker(point);
marker.openInfoWindowHtml(address);
GEvent.addListener(marker, 'click',
function() {
marker.openInfoWindowHtml(text);
}
);
map.addOverlay(marker);
}
}
);
}
</script>
<script>
window.onload=function(){
initialize();
};
</script>
<style type="text/css" media="screen">
#map { float:left; width:750px; height:750px; }
</style>
</head>
<body>
<div id="map"></div>
<script>
<!-- within this section we contact the server to read the file
(called 'somefile.xml') -->
<!-- then we continue to use jquery to parse the file we have read.
If you take a look at -->
<!-- the somefile.xml you will see it has a 'location' tag
<location>. So we want to read that-->
<!-- location and then have the showAddress() function show the
location on the map.-->
$(document).ready(function()
{
$.ajax({ type:"GET"
,url:"somefile.xml"
,dataType:"xml"
,error:function(XMLHttpRequest,
textStatus, errorThrown)
{
alert(textStatus);
}
,success: function(xml)
{
var locationText="";
$(xml).find('statuses > status
').each(function()
{
locationText="";
textText="";
locationText += $
(this).find('user > location').text();
textText += $(this).find('status > text').text();
textText += $(this).find('text').text();
showAddress(locationText, textText);
});
}
});
});
</script>
</body>
</html>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---