Google is your friend: http://stackoverflow.com/questions/7594740/convert-objects-to-json-and-send-via-jquery-ajax http://stackoverflow.com/questions/3168401/json-formatting-sending-json-via-jquery-ajax-post-to-java-wicket-server http://www.intelligrape.com/blog/2010/06/11/jquery-send-json-object-with-an-ajax-request/
On Sunday, February 12, 2012 10:54:48 AM UTC-5, Vineet wrote: > > I see. > That means neither cPickle nor session can be used. > > A workaround can be like this-- > Keep the dataset stored in session. > On client-side, after hitting the save button, collect the values of > elements in JSON array format. > I can't use request.vars.elmt, because I require to pass the class > values also (of html elements) to the ajax controller. > (These class values are set/altered after user-interaction.) > web2py's ajax function can't pass JSON array to controller. > > Can you pl. tell how to pass JSON array to controller via ajax? > (maybe $.ajax ?) > > Thanks, > > Vineet > > On Feb 11, 10:28 pm, Anthony <[email protected]> wrote: > > > 3) User interacts with HTML elements & changes the data. > > > > > 4) Dynamically, the dataset is altered after user-interaction with > > > HTML elements. > > > > In that case, this part of your view won't work: > > > > {{for i in newD:}} > > .......processing statements....... > > {{pass}} > > {{cPickle.dump(newD, open( "my_pkcl.p", "wb" ) )}} > > > > Anything done in the web2py template language has to happen on the > server > > (before sending the page to the browser), not in the client. > cPickle.dump > > cannot be called from the browser -- that is strictly a server-side > > operation. Anything that happens on the client side has to be done via > > Javascript (and/or a standard form submission). > > > > > 5) After hitting 'Save' button, the dataset is passed to controller > > > function for handling add/update/delete on related DB tables. > > > > This sounds fine. It's not clear you need to store the data in the > session > > at all. It sounds like you can just load the data in the view, let the > user > > make and submit changes, and then simply update the db with those > changes. > > > > Anthony

