Hi Rick,
You can just pack your data in a JSON structure and send it like:

var req = getXMLHttpRequest();
req.open('POST','my_tg_method',true);
req.setRequestHeader('Content-type','application/x-www-form- urlencoded'); var data = 'your_complex_data_structure='+ serializeJSON (your_complex_data);
var d = sendXMLHttpRequest(req,data);

On the server side you have in your controller the method:

import simplejson

def my_tg_method(self,your_complex_data_structure):
        #pack  up your json structure and do what you need with it
your_now_pythonic_complex_data_structure = simplejson.loads (your_complex_data_structure)

Cheers
Ronald


On Jan 31, 2006, at 10:35 AM, rick wrote:



I have a rather complex set of heirarchical data that i need to return
from a web page back to TG. I'm just not sure of the best way to do it.


MochiKit has a sendXMLHTTPRequest (No sendJSONRequest unfortunately)
which should allow me to easily pack up the datasets and ship them off.
But I'm not quite sure how to receive that info on the TG side.

If anyone has a better method or can prescribe a recipe in TG that be
great. If no current solution exists I'll attempt to roll my own and
put a recipe in trac.


________________________________
Ronald Jaramillo
mail: ronald AT checkandshare DOT com
blog: http://www.checkandshare.com/blog



Reply via email to