User-565568023 posted
Hi all;
here is my FB LOGIN and send to DB function. Ajax function working when i define variable after ajax its working but when i try to define inside login function its not working.
Here is sending value A,B,C,D but when i try to do it inside fb login function not working. thx
function Login() {
FB.login(function (response) {
if (response.authResponse) {
getUserInfo();
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, { scope: 'email,user_photos,user_videos' });
}
function getUserInfo() {
FB.api('/me', 'GET', { "fields": "id,name,picture.width(87).height(60),email" }, function (response) {
// var isim = response.name;
// var fbid = responseid;
// var fbresim = response.picture.data.url;
// var fbemail = response.email;
ShowCurrentTime();
})
};
function ShowCurrentTime() {
var isim ="A";
var fbid = "B";
var fbresim = "C";
var fbemail = "D";
$.ajax({
type: "POST",
url: "anasayfa.aspx/kaydet",
data: "{'isim':'" + isim + "', 'fbid':'" + fbid + "', 'fbresim':'" + fbresim + "', 'fbemail':'" + fbemail + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert(msg.d);
return false;
}
})
};