locked
AJAX POST METHOD Problem RRS feed

  • Question

  • 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;

    }
    })
    };

    Wednesday, March 15, 2017 6:52 PM

All replies

  • User-565568023 posted

    Sending null data :(

    Wednesday, March 15, 2017 7:11 PM
  • User-565568023 posted

    hidden field area value not eligible for variable var. if i use label it is work. 

    Thursday, March 16, 2017 4:23 AM