Seems you're still missing one more function.
function parseXml( str )
{
if (window.ActiveXObject)
{
var doc = new ActiveXObject('Microsoft.XMLDOM');
doc.loadXML(str);
return doc;
}
else if (window.DOMParser)
{
return (new DOMParser).parseFromString(str, 'text/xml');
}
}
On Jun 10, 10:20 am, Tinman <[email protected]> wrote:
> Thanks, I got that added now, but still no markers are showing up on
> the map, I though they might have been invisible but they are not
> there at all.
>
> On 10 Jun, 16:02, Scorpius <[email protected]> wrote:
>
>
>
> > Looks like you still haven't defined the function doNothing yet.
> > Just use:
> > function doNothing() {}
>
> > On Jun 10, 9:06 am, Tinman <[email protected]> wrote:
>
> > > Thanks for your reply.
> > > I tried to define it with this code:
>
> > > function downloadUrl(url,callback) {
> > > var request = window.ActiveXObject ?
> > > new ActiveXObject('Microsoft.XMLHTTP') :
> > > new XMLHttpRequest;
>
> > > request.onreadystatechange = function() {
> > > if (request.readyState == 4) {
> > > request.onreadystatechange = doNothing;
> > > callback(request.responseText, request.status);
> > > }
> > > };
>
> > > request.open('GET', url, true);
> > > request.send(null);
>
> > > }
>
> > > And now the map loads again, but it does not load any markers.
> > > Is there something wrong in the first piece of code maybe?
>
> > > Thanks again for your reply, getting the downloadUrl defined seems to
> > > have been part of the answer.
>
> > > On 10 Jun, 10:15, Davide Cremonesi <[email protected]> wrote:
>
> > > > downloadUrl is not defined.
> > > > google.maps.DownloadUrl or GDownloadUrl are part of the v2 API.
> > > > Now v3 is loaded by default, so if you want to use v2 APIs you have to
> > > > load it explicitly specifying the v=2 in the google maps api URL.
>
> > > > Ciao,
> > > > Davide
>
> > > > On Jun 10, 8:53 am, Tinman <[email protected]> wrote:
>
> > > > > Hi.
> > > > > I have been working on a dynamic map for a game lately and I am trying
> > > > > to add markers from database entries.
> > > > > I have mad the database and added a few entries into it, I have also
> > > > > made a .php file that creates a xml file that the Google Maps API
> > > > > should be able to collect information from that to add markers onto my
> > > > > map.
>
> > > > > The map is located here:http://www.undergroundrp.com/dev3/map.html
> > > > > The .php file that creates the .xml file is
> > > > > here:http://www.undergroundrp.com/dev3/phpsqlajax_genxml.php
>
> > > > > The code I am currently using to attempt to collect the xml
> > > > > information and put it onto the map:
>
> > > > > <!--Add Markers From Database Start-->
>
> > > > > downloadUrl("phpsqlajax_genxml.php", function(data) {
> > > > > var xml = parseXml(data);
> > > > > var markers = xml.documentElement.getElementsByTagName("marker");
> > > > > for (var i = 0; i < markers.length; i++) {
> > > > > var name = markers[i].getAttribute("name");
> > > > > var description = markers[i].getAttribute("description");
> > > > > var image = markers[i].getAttribute("icon");
> > > > > var point = new google.maps.LatLng(
> > > > > parseFloat(markers[i].getAttribute("lat")),
> > > > > parseFloat(markers[i].getAttribute("lng")));
> > > > > var html = "<b>" + name + "</b> <br/>" + description;
> > > > > var image = 'http://google-maps-icons.googlecode.com/files/'+icon;
> > > > > var marker = new google.maps.Marker({
> > > > > map: map,
> > > > > position: point,
> > > > > icon: image,
> > > > > shadow: 'http://google-maps-icons.googlecode.com/files/
> > > > > shadow.png'
> > > > > });
> > > > > bindInfoWindow(marker, map, infoWindow, html);
> > > > > }
>
> > > > > });
>
> > > > > <!--Add Markers From Database End-->
>
> > > > > But this "destroys" my map, and I have no idea how to do this, I have
> > > > > no problem with php and sql but when it comes to this Java and Google
> > > > > Maps API I am really a noob ^^
>
> > > > > If anyone got any idea on how I would be able to load this I would be
> > > > > very greatfull.
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.