It makes a fair bit of sense.. I've heard a lot of good things about jquery. If you could post the view later I think I'll be off and running. Thank you for the help with this. I find the difficulty with web coding is beginnings... I think that I'm getting a good idea on how to proceed.
On Sep 15, 9:52 am, David Christiansen <[EMAIL PROTECTED]> wrote: > Here's what my code looks like to get information from the server to > display on the map: > > function update_locations () { > bounds = map.getBounds(); > sw = bounds.getSouthWest(); > ne = bounds.getNorthEast(); > $.getJSON('/locations/locations/', > {'lat1':sw.lat(), 'long1':sw.lng(), > 'lat2':sw.lat(), 'long2':ne.lng(), > 'lat3':ne.lat(), 'long3':ne.lng(), > 'lat4':ne.lat(), 'long4':sw.lng()}, > function(data, textStatus){ > $.each(data, function() { > //Check if currently in set, add if not > if (markerSet["key"+this.id]) {} > else { > latlng = new GLatLng(this.latitude, > this.longitude); > marker = new GMarker(latlng, > {'title':this.name}); > marker.bindInfoWindowHtml("<iframe src=\"/ > locations/info/"+this.id+"/\"></iframe>"); > markerSet["key"+this.id] = marker; > markerManager.addMarker(marker, 10); > } > }); > } > ); > > } > > In my onload event handler for the page, I have this: > > GEvent.addListener(map, 'moveend', update_locations); > > I don't have access to the Django view that responds to the request > right now, but I could post it later if it would be helpful. It > basically just creates a polygon from the lat/long GET parameters and > then does a GeoDjango query for the points inside that polygon. It > then iterates over them and constructs a JSON-encoded list of > JavaScript objects, which it puts into the HTTPResponse. > > The code uses JQuery, which I've found really helpful in reducing the > pain of Javascript. That's what all the funny $ variables are. Does > this make sense? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---