Created
September 12, 2013 11:56
-
-
Save charyorde/6536222 to your computer and use it in GitHub Desktop.
Asynchronously(one after the other) execute bits of code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.renderUI = function(res) { | |
var connected = (res.user != null && res.user.isConnected); | |
var contactsData = []; | |
if(connected) { | |
$j('#jive-modal-invite').trigger('close'); | |
contactsData['contacts'] = gigya.socialize.getContacts({callback: function(response){ // How can I async js this line such that only when this returns should alert be called? | |
contactsData['contacts'] = response; | |
}}); | |
alert(contactsData); // returns null | |
} | |
}; | |
// Executing the code will return 'undefined' for contactsData. |
gigya.socialize.getContacts({callback: function(response){
contactsData['contacts'] = response;
}
},
gigya.socialize.getContacts.contactsData = contactsData;
);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gigya.socialize.getContacts({callback: function(response){
contactsData['contacts'] = response;
},
gigya.socialize.getContacts.contactsData = contactsData;
});