Is it entire possible to run Facebook SDK code integrated into a jQuery script?
Example:
$("#getStarted").click(function() {
FB.login(function(response) {
if (response.authResponse) {
var accessToken = response.authResponse.accessToken;
}
});
.....
I would like to only give the Facebook login box once a user clicked on a button on my application. The instance above runs the FB.login irrespective if the user clicked the button or not. The FB code DOES WORK, but not in the order required.
This did end up to work, however, the example above still ran irrespective if the button was clicked or not, but for other FB.ui() functions it worked perfectly within jQuery code. I can only advise that you write your code in the following order:
1) do the FB.unit()
2) Run your jQuery and FB function
3) Run the FB async code afterwards.
This worked for me.