I realize why my function isn't returning the correct value, the callback isn't returning data yet, and I get the previous return value. However, that's what I am trying to work around. I am looking for a way to get readyState or status on the callback to see whether it has completed yet or not. I don't want to have to recreate the function everytime I call it. In some places it's not possible, since I have several callbacks in a row that require the previous one to complete to compute values to call the next.
Have I just reached the limitations of the current implementations of OpenSocial?
Oh, and I have no problems updating data using the API. I use the following function.
function updateData(keyID, keyValue) {
var statusField = document.getElementById('statusField');
var req = opensocial.newDataRequest();
req.add(req.newUpdatePersonAppDataRequest('VIEWER', keyID, escape(keyValue) ));
req.send(updateSent);
}
function updateSent(response) {
statusField.innerHTML = (response.hadError()) ? 'Error updating data... ' + response.getError() : 'Data Saved...<br>';
}