Ronald Jaramillo wrote:
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)
Depending on how complicated or simple the datastructure is, you may be
able to get away with
<form id='myform'> <- put the ID in the form properly.
loadJSONDoc('my_tg_method?' + queryString('myform')); <- pack the query
string from the form.
def my_tg_method(self, **data): <- grab the data out of the kwargs.
--
Regards,
Stephen Thorne
Development Engineer
Scanned by the NetBox from NetBox Blue
(http://netboxblue.com/)