what is wrong in the code?????? not running this ... I tried this
code ... use array pra register several keys dynamically and their
values , help me plis !!!
<script type="text/javascript">
gadgets.util.registerOnLoadHandler(requestData);
var htmlout = "";
var me = null;
function AddData() {
var req = opensocial.newDataRequest();
var palavras = document.getElementById("input_comm").value;
var thefield = [];
req.add(req.newUpdatePersonAppDataRequest("VIEWER",
thefield[thefield.length], palavras));
req.send(requestData);
}
function requestData() {
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(handleRequestData);
}
function handleRequestData(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
doSomethingWithData(mydata.getData());
}
function doSomethingWithData(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"];
document.getElementById('content_div').innerHTML +=
mydata[mydata.length] + "<br />";
}
</script>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenSocial Application Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/opensocial-api?hl=en
-~----------~----~----~----~------~----~------~--~---