On Mar 1, 7:06 am, youradds <[email protected]> wrote: > Hi, > > Got a bit of a weird one. I'm using the "zoomend" and "moveend" > function to reload the map whenever they zoom in, or move the map. > > The problem seems to be that its calling this function 2 times > whenever we zoom in (I guess cos the "moveend" is also changing, as > the location of the map has changed) > > I'm afraid I dont have a link I can send you to, so will just show the > example of the 2 functions I'm using (I'm sure I'll get stick for it > from someone!) > > Example: > > GEvent.addListener(map, "moveend", function() { > .. do stuff here (loads the AJAX) > > }); > > GEvent.addListener(map, "zoomend", function(oldzoom,newzoom) { > .. do stuff here (loads the AJAX) > > }); > > Now, this is ok - appart from the fact we are going to be having > literally tens of thousands of visitors to this page each day, so we > don't really want it to keep calling the server 2 times for each map > change a user does (zooming in, moving around, etc) > > Can anyone suggest a work around for this?
You could try adding some code to not perform not send a second request if the first is in progress. That may not give the desired results as ".. do stuff here (loads the AJAX)" might need to the status from the second event rather than the first... A link would help tell what you are actually talking about. -- Larry -- 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.
