facebook测试api中php变量中的javascript值存储

facebook测试api中php变量中的javascript值存储,javascript,php,facebook,Javascript,Php,Facebook,我使用FacebookAPI获取响应,在json中获取所有值,也获取单个值。我想把这个值存储在php变量中 function testAPI() { console.log('Welcome! Fetching your information.... '); FB.api('/me', function(response) { console.log(JSON.stringify(response)); console.log('Success

我使用FacebookAPI获取响应,在json中获取所有值,也获取单个值。我想把这个值存储在php变量中

 function testAPI() {
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me', function(response) {
         console.log(JSON.stringify(response));
      console.log('Successful login for: ' + response.name);
      document.getElementById('status').innerHTML =
        'Thanks for logging in, ' + response.email + '!';

        var email = response.email;
    });


  }

<div id="status" ></div>
函数testAPI(){
log('欢迎!获取您的信息…);
FB.api('/me',函数(响应){
log(JSON.stringify(response));
console.log('successfulllogin for:'+response.name);
document.getElementById('status').innerHTML=
'感谢您登录,'+response.email+'!';
var email=response.email;
});
}
我正在用脚本创建电子邮件varibale如何存储为我的php varibale你能建议我吗

     function testAPI() {
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me', function(response) {

        var mydata = JSON.stringify(response);
        //console.log(mydata);
         //console.log(JSON.stringify(response));
      //console.log('Successful login for: ' + response.name);
      document.getElementById('status').innerHTML =
        'Thanks for logging in, ' + response.email + '!';

     //  setCookie("fb_user_data",JSON.stringify(response),"1");

      myajax(mydata);




      //  var email = response.email;
    });

    //delete_cookie('fb_user_data');    
  }

function myajax(mydata){

    var mydata = mydata || "";
    var send_data = "fbdata="+mydata;
     $.ajax({
       type: "GET",
       url: "/learn_test/response.php",
       data: send_data,
       datatype : "json",
       success: function(response){
        console.log(response)
        /*alert(response.msg);
        alert(response.error);
        alert(response.run);*/

       }
        });
}
在reponse.php中设置响应

if(isset($_GET['fbdata'])){
$fbarry = print_r(json_decode($_GET['fbdata']),true);
$msg = array();
$msg['msg'] = "done";
$msg['error'] = "";
$msg['run'] = true;
//$msg['run'] = false;
 print_r(json_decode($_GET['fbdata']));
}
我可以得到价值