Using facebook API javascript getting email -


i have method , want email of person , send email=undefined.

first try:

     function testapi() {     fb.login(function(response) {      if (response.authresponse) {        console.log('welcome!  fetching information.... ');        fb.api('/me', function(response) {          console.log('good see you, ' + response.email + '.');          alert('good see you, ' + response.email + '.');        });      } else {        console.log('user cancelled login or did not authorize.');      }    }, {scope:'email'}); 

i searching , found have use {scope:image} , if put it, dont show me alert

your syntax wrong, that's correct one:

function testapi() {     fb.login(         function(response) {             if (response.authresponse) {                console.log('welcome!  fetching information.... ');                fb.api('/me', function(response) {                    console.log('good see you, ' + response.email + '.');                    alert('good see you, ' + response.email + '.');                });             } else {                 console.log('user cancelled login or did not authorize.');             }         },         {scope:'email'}         ); } 

where {scope:'email'} inside ) second argument of fb.login


Comments