Hi,

I'm making some tests with AJAX request to retreive json datas.

I tried this example code:

    new Ajax.Request('/exec.py', {
        method: 'get',
        onSuccess: function(transport, json) {
            alert(json ? Object.inspect(json) : "no JSON object");
        }
    });

My request is made on a mod_python page, which returns the json data:

    records = Adherent.selectBy(adherent='Oui')  # SQLObject request
    req.content_type = "application/json"
    data = [{'num': record.num,
             'prenom': record.prenom,
             'nom': record.nom} for record in records]
    req.write(simplejson.dumps(data))
    return ""

But it does not work: the json var doesn't contain any valid json data...

What am I doing wrong? Is the content_type correct? I found on different 
forums that this is the one to use for json, but Prototype may need another 
one? I also tried:

    application/x-json
    text/x-json

without success.

Thanks,

-- 
   Frédéric

--

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.


Reply via email to