xRobot
xRobot

Reputation: 26565

How to use Facebook jsdk?

I want to know what is the best way to save some informations about the user in my database.

With this code I get that informations:

 FB.api({
     method: 'fql.query',
     query: 'select first_name, last_name, sex, pic from user where uid=me()'
 }, function (response) {
    // save informations
 });

But now, how can I put these informations in my database ?

Is ajax the best way to do that ?

Or I have to use PHP sdk in this case ?

Upvotes: 0

Views: 91

Answers (1)

DMCS
DMCS

Reputation: 31880

But now, how can I put these informations in my database ?

In the lines commented "save informations", simply AJAX the data to your webserver.

Is ajax the best way to do that ?

Yes, AJAX is the best way to get data instantly back to your server once the FB.api call has completed.

Or I have to use PHP sdk in this case ?

No, in this case your code is running client-side. Why duplicate it server-side too? No need. Just remember, the less things your server has to do (because you off-load much of it to the client) the better for your server's performance and lower cost to maintain the server.

Upvotes: 1

Related Questions