Hi, We have one example for storing a list and getting it back. This example was written for code run. Could you use this code as the reference?
One obvious thing, I can see in your code is that you are not using gadgets.util.escapeString() and gadgets.utils.unescapeString() functions. function storeData(){ var list=["apple","banana","orange"]; var json = gadgets.util.escapeString(gadgets.json.stringify(list)); var req = opensocial.newDataRequest(); req.add(req.newUpdatePersonAppDataRequest("VIEWER", "thefield",json)); req.send(getData); } function getData(data){ var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest("VIEWER"),"viewer"); req.add(req.newFetchPersonAppDataRequest("VIEWER", "thefield"),"viewerData"); req.send(displayData); } function displayData(response){ var person=response.get("viewer").getData(); var theFieldValue=gadgets.util.unescapeString(response.get("viewerData").getData() [person.getId()].thefield); var obj=gadgets.json.parse(theFieldValue); alert(obj); } storeData(); Thanks, Rohit On Jun 30, 9:25 pm, Vinicius <[EMAIL PROTECTED]> wrote: > <script type="text/javascript"> > gadgets.util.registerOnLoadHandler(requestComm); > > var htmlout = ""; > var me = null; > var aff = []; > > function AddComm() { > var req = opensocial.newDataRequest(); > var mylink = document.getElementById("input_comm").value; > aff = mylink; > var json = gadgets.json.stringify(mylink); > > req.add(req.newUpdatePersonAppDataRequest("VIEWER", "thefield", > json)); > req.send(requestComm); > } > > function requestComm() { > var req = opensocial.newDataRequest(); > var fields = [ "thefield" ]; > > req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER), > "viewer"); > req.add(req.newFetchPersonAppDataRequest("VIEWER", fields), > "viewer_data"); > req.send(handleRequestComm); > } > > function handleRequestComm(data) { > var mydata = data.get("viewer_data"); > var viewer = data.get("viewer"); > me = viewer.getData(); > > if (mydata.hadError()) { > htmlout += data.getError(); > return; > } > // Do something with the returned data - note the getData call > doSomethingWithComm(mydata.getData()); > } > > function doSomethingWithComm(data) { > //Data is indexed by user id, and represents an object where > keys > //correspond with the app data fields. > var mydata = data[me.getId()]["thefield"]; > var ow = gadgets.util.unescapeString(mydata); > aff = gadgets.json.parse(ow); > > document.getElementById('content_div').innerHTML += aff + "<br />";} > > </script> > > this code, > does not work, help !!! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Orkut Developer Forum" group. To post to this group, send email to opensocial-orkut@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/opensocial-orkut?hl=en -~----------~----~----~----~------~----~------~--~---