I'm using AJAX, jquery and JSON for the first time, having used
templates to render XML for Flex/Flash in all my previous Django work.
My code looks like this

records = models.Residents.objects.extra( where=[....], params=[...])
data = serializers.serialize('json', records, ensure_ascii=False,
fields=('fname','lname', 'pt'))
return HttpResponse(data)

After experimenting the "ensure_ascii=False" seems to get rid of the
Unicode prefix which is not used in my work.

which returns 
[
{"pk": "77777", "model": "app.residents", "fields": {"lname": "Mouse ",
"pt": "0", "fname": "Minnie "}},
...]

I was surprised to see the subnode "fields" in the output.  Perhaps I'm
just old school having does basic cgi with json and pretty much forced
the format.  

1. However is the above the "best practice" or is there an option to
strip the meta data.

2. Does someone have a "best practice" jquery snippet to work with these
nested fields.

3. Would it be a cleaner solution to use a template to return some
"inner html" that ajax would use without any parsing logic.

I apologize for asking such basic questions, but I'm working solo and
this is my first serious HTML5 project after mostly using Flex and XML.

Thanks.

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