I am using var userID = (FB.getAuthResponse() || {}).userID;
to get ID of logged in user, FB .init is initialized properly.
The issue that I am encountering is If I put
var userID = (FB.getAuthResponse() || {}).userID;
inside document.ready();
it is returned as undefined whereas if I put it in some javascript function and call that function on a button click, it works perfectly fine.
Anyone know what could be the issue?
I am also getting this when I try to access it directly on my website:
XMLHttpRequest cannot load {CALL o be MADE}. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '{MY WEBSITE ADDRESS}' is therefore not allowed access. (index)
PS: I don't get the above mentioned error in my facebook page tab, I only get this when I try to access directly my website.