title: Beginner in JS and as3
body: <p>I have no experience with javascript and hence this silly question... I don't know what's wrong with this code... may be its the scope of the two variables.. but i am not able to retrieve the values of the variables in the function... please help.</p>
  
  <pre><code>function fetchFBData (userId)
      {
          //console.log (userId);
  
          var picurl;
          var playername;
  
          FB.api('/'+userId+'/picture?width=50&amp;height=50', picResponse);
          FB.api('/'+userId, nameResponse);
  
          function picResponse (response)
          {
              picurl = response.data.url;
              console.log(picurl);
          }
  
          function nameResponse (response)
          {
              playername = response.name;
              console.log (playername);
          }
  
          document.getElementById("demo1").playerData(playername, picurl);            
      }
  </code></pre>