Hi,

I am able to send JSON data from Django to my javascript function, but
I would like to iterate JSON by using the Django template language. Is
this possible at all?

For example, my view passing JSON back:
def ajax_form_test(request):
  data = serializers.serialize("json", Order.objects.all())
  if request.method == 'POST':
    return HttpResponse(data, mimetype="application/json")

And my Javascript function that receives JSON:

   function hello() {
     var form_data = {
        url: "/ajax_form_test/",
        handleAs: "json",
        load: function(data){
          dojo.byId("myDiv1").innerHTML = data;
        },
        error: function(data){
                alert("Holy Bomb Box, Batman!  An error occurred: " +
data);
        },
        timeout: 5000,
        form: "myForm"
    };
    dojo.xhrPost(form_data);
   }

Right now the way my template displays JSON is by using innerHTML as
above. But I would like to convert the data somehow so that Django can
iterate in the {{...}} syntax.

Thanks,

robo


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

Reply via email to