I'm trying to update a local variable in a function with the returned data from a callback function. But it's looking like the callback function doesn't have access to it.
Below is what I'm working with:
this.renderUI = function(res) {
var connected = (res.user != null && res.user.isConnected);
if(connected) {
$j('#jive-modal-invite').trigger('close');
var contactsData = gigya.socialize.getContacts({callback: getContacts_callback });
console.log(contactsData);
}else {
console.log('openid disconnected');
}
};
function getContacts_callback(response) {
return response;
}
gigya.socialize.getContacts({callback: function(response){instead ofgigya.socialize.getContacts(function(response){?getContactsis asynchronous, you simply cannot (and should not). Put the logging statements (and everything else the accessescontactsData) in the callback