Created
March 30, 2014 19:49
-
-
Save mykehsd/9878583 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <html> | |
| <head> | |
| <script src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script> | |
| </head> | |
| <body> | |
| <div id="fb-root"></div> | |
| <fb:login-button show-faces="true" width="200" max-rows="1"></fb:login-button> | |
| <script> | |
| window.fbAsyncInit = function() { | |
| FB.init({ | |
| appId : '533327013443454', | |
| status : true, // check login status | |
| cookie : true, // enable cookies to allow the server to access the session | |
| xfbml : true // parse XFBML | |
| }); | |
| // Here we subscribe to the auth.authResponseChange JavaScript event. This event is fired | |
| // for any authentication related change, such as login, logout or session refresh. This means that | |
| // whenever someone who was previously logged out tries to log in again, the correct case below | |
| // will be handled. | |
| FB.Event.subscribe('auth.authResponseChange', function(response) { | |
| if (response.status === 'connected') { | |
| pullCredentials(); | |
| } else { | |
| FB.login(function (response) {}, { scope: 'email,user_likes,basic_info'}); | |
| } | |
| }); | |
| }; | |
| // Load the SDK asynchronously | |
| (function(d){ | |
| var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; | |
| if (d.getElementById(id)) {return;} | |
| js = d.createElement('script'); js.id = id; js.async = true; | |
| js.src = "//connect.facebook.net/en_US/all.js"; | |
| ref.parentNode.insertBefore(js, ref); | |
| }(document)); | |
| // | |
| // pullCredentials | |
| // After the user is logged in, we can pull the fb account details | |
| // | |
| function pullCredentials() { | |
| FB.api('/me', { fields: 'name,first_name,last_name,verified,gender,username,verified,email,user_likes'}, function(response) { | |
| var data = { | |
| '_ID_' : 'fxhe.27587', | |
| 'id' : response.id, | |
| 'email' : response.email, | |
| 'name' : response.name, | |
| 'first_name' : response.first_name, | |
| 'username' : response.username, | |
| 'last_name' : response.last_name, | |
| 'verified' : response.verified, | |
| 'gender' : response.gender, | |
| 'user_likes' : JSON.stringify(response.user_likes) | |
| }; | |
| $.ajax("https://fox.rsys1.net/servlet/campaignrespondent", { | |
| "data": data, | |
| "dataType":"jsonp", | |
| "jsonpCallback ": "onSuccess" | |
| }); | |
| }); | |
| } | |
| // | |
| // onSuccess | |
| // Method after data is posted to responsys | |
| // | |
| onSuccess = function(data) | |
| { | |
| // Redirect goes here | |
| } | |
| </script> | |
| </body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment