Click here to Skip to main content
15,905,414 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
This my javascript code

how to pass the values id , name ,pic in c#.net......?

JavaScript
<script type="text/javascript">
     // 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));

     // Init the SDK upon load
     window.fbAsyncInit = function () 
               {
         FB.init({
             appId: '390102924456276', // App ID
             channelUrl: '//' + window.location.hostname + '/channel', // Path to your Channel File
             status: true, // check login status
             cookie: true, // enable cookies to allow the server to access the session
             xfbml: true  // parse XFBML
         });

         // listen for and handle auth.statusChange events
         FB.Event.subscribe('auth.statusChange', function (response) {
             if (response.authResponse) {
                 
                 // user has auth'd your app and is logged into Facebook
                 var uid = "http://graph.facebook.com/" + response.authResponse.userID + "/picture";
                 FB.api('/me', function (me)
                  {
                     document.getElementById('auth-displayname').innerHTML = me.name;
                     document.getElementById('Email').innerHTML = me.email;
                     document.getElementById('profileImg').src = uid;
                 })
                 document.getElementById('auth-loggedout').style.display = 'none';
                 document.getElementById('auth-loggedin').style.display = 'block';
             } else {
                 // user has not auth'd your app, or is not logged into Facebook
                 document.getElementById('auth-loggedout').style.display = 'block';
                 document.getElementById('auth-loggedin').style.display = 'none';
             }
         });
         $("#auth-logoutlink").click(function () 
         { FB.logout(function () { window.location.reload(); }); });
     }
</script>
Posted
Updated 12-Dec-13 23:01pm
v2
Comments
Karthik_Mahalingam 13-Dec-13 5:31am    
have a look at this link

http://www.codeproject.com/Questions/228944/

1 solution

Save data to hidden field then post the form

Like
XML
document.getElementById('<%= hdnName.ClientID %>').value = me.name;
document.getElementById('<%= hdnEmailAddress.ClientID %>').value = me.email;
document.getElementById('hdnfbid').value = me.id;


or use webmethods to pass it.
 
Share this answer
 
Comments
Gujula Ravindra Reddy 13-Dec-13 5:27am    
Hi
Sorry for the disturb my requriment is click on facebooklogin id,name,email bind in c#.net

please give me the answer....?
Taha Akhtar 13-Dec-13 12:47pm    
when user login using facebook FB.api( is called and all your data goes in me variable and all you have to do some in
FB.api(...) function

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900