I test this code. It works. However, the map also generates a lot of
redundant old markers, which cause the google map to suspend. My
question is how to  remove the old marker position when the php file
is called

On Mar 8, 8:53 pm, vincent198471 <[email protected]> wrote:
> Is that what you mean?
>  setInterval(function(){
>         var random ="?="+(new Date()).getTime();
>     downloadUrl("phpsqlajax_genxml.php"+random,function(data){
>     var xml = data.responseXML;
>     var aircraft =
> xml.documentElement.getElementsByTagName("Aircraft");
>     for(var i=0;i<aircraft.length;i++)
>     {
>         var ICAO = aircraft[i].getAttribute("ICAO");
>         var point = new
> google.maps.LatLng(parseFloat(aircraft[i].getAttribute("latitude")),parseFloat(aircraft[i].getAttribute("longtitude")));
>         var marker = new google.maps.Marker({
>           map:map,
>           position:point,
>           icon: aircraftIcon
>
>         });
>     }
>  })},10000);
>
> On Mar 8, 8:27 pm, Esa <[email protected]> wrote:
>
> > > I try to setTimeout, but it doesnot work.
>
> > Sure setTimeout() works. However setInterval() is more suitable for
> > the purpose.
>
> > Without seeing your page, I quess that you have a browser cache
> > problem. You cannot see the updated file on map because the file comes
> > from browser cache. The common workaround is to change the filename
> > with a random parameter.
>
> > setInterval(function(){
> >   var random = "?=" + (new Date()).getTime();
> >   downloadUrl("phpsqlajax_genxml.php" + random, function(data){ ...
>
> > }, 10000);

-- 
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.

Reply via email to