I ve used this method in .NET to pass data back and forth between client and server using JSON objects (both ways). I really liked the method and am looking to do something similar with web2py. Web2py supports returning json objects and supports jsonrpc. I haven t however been able to make it parse a JSON object. My client call looks like this:
var testObject = {};
testObject.value1 = "value1value!";
testObject.value2 = "value2value!";
var DTO = { testObject : testObject };
var data = $.toJSON(DTO); //Using the toJSON plugin by Mark Gibson
$.ajax({
type: POST ,
url: /MyWeb2PyApp/MyController/jsontest.json ,
contentType: "application/json; charset=utf-8",
data: data,
dataType: json ,
success: function(data){ alert( yay ); }
});
I ve tried a bunch of stuff in my jsontest action and nothing works.
Has anyone been able to accomplish something similar?
Much appreciated.