Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-28-2011, 03:20 AM   PM User | #1
cherple
New to the CF scene

 
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
cherple is an unknown quantity at this point
value from javascript to php

Hi guys, i tried searching for solutions regarding an issue i'm facing but i can't seem to understand what others are asking or the solutions given. I'm not sure if its because our codes are different or what.

Basically the problem i'm facing is that i'm trying to allow user to login to my website using facebook, i'm able to retrieve user's facebook username n information but i'm unable to extract them into my php file as the codes are within a script as shown.

<script>
FB.init({
appId:'app_id', cookie:true,
status:true, xfbml:true
});
FB.api('/me', function(user) {
if(user != null) {
var image = document.getElementById('image');
image.src = 'http://graph.facebook.com/' + user.id + '/picture';
var name = document.getElementById('name');
name.innerHTML = user.name
//document.getElementById('username').innerHTML = user.username;
var username = document.getElementById('username');
username.innerHTML = user.username
}
});
</script>

<fb:login-button perms="email"> Login with Facebook </fb:login-button>
<div align="left">
<img id="image"/>
<div id="name"></div>
<div id="username"></div>
</div>

I'm able to get the user's username using 'user.username' within the script but i'm unable to save it in my php login page which i'm gonna use it to store into my database.

From my understanding this can be done either using cookie or a hidden field but i'm not sure how to integrate them into my code.

Hope there's some pros here who can help this noob.. =[
cherple is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:36 PM.


Advertisement
Log in to turn off these ads.