Russ said it better than me. You simply return the serialized JSON
string as the HttpResponse. You then deserialize it somehow in the
client's Javascript code (perhaps with an "eval" statement or by the
assistance of a Javascript library like jQuery, etc.). You then have a
nice Javascript object that you can manipulate and use to add points
to the map in Javascript.

I have implemented something like this before with PHP and Javascript.
I am converting it to my Django powered site. My current client code
is straight Javascript. This time I intend to leverage jQuery to make
my code smaller, and hopefully a bit more portable.

If you want to see how I did it in plain old Javascript, my old code
can be found here:
https://sourceforge.net/projects/membermapnuke/

If you drill into the code look for mmap.js for the client side stuff
and ajax.php for the server side. I'm porting this to Django at the
moment, and I'm looking forward to trying out Django's serializer for
this.

Best,
BN

On Feb 4, 11:41 pm, issya <floridali...@gmail.com> wrote:
> Thanks for the reply Russ. I will check into different things, you
> make it sound easier than it looks. :)
>
> On Feb 4, 11:33 pm, Russell Keith-Magee <freakboy3...@gmail.com>
> wrote:
>
>
>
> > On Thu, Feb 5, 2009 at 1:09 PM, issya <floridali...@gmail.com> wrote:
>
> > > Thanks for the reply. I was aware of that but I guess I don't
> > > understand how to go about using it. I do understand that I can
> > > serialize a queryset. But I cannot just go and use the serialized data
> > > as template context. From the options I've seen, it looks like if I
> > > did something like that I would have to process everything with the
> > > javascript including iterating through the data and making an html
> > > layout. I may be confused though, little sleep and a lack of knowledge
> > > will do that.
>
> > There is no need for templates to be involved at all. Django's
> > serializers will turn a queryset into a serialized string. That string
> > can be provided literally as the content for a HttpResponse (just
> > remember to set the content type for the response to suit the
> > serialization format). You don't need to go through a template
> > rendering process on top of this.
>
> > What you then do on the client side is entirely up to you - jQuery
> > provides some nice deserialization methods for AJAX requests, but
> > there are many other options.
>
> > Yours,
> > Russ Magee %-)- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to