title: json.stringify is not a function error at JavaScript
body: <p>I'm using login, registration Facebook API with JavaScript in a WordPress plugin. I got this error</p>
  
  <pre><code>json.stringify is not a function error at JavaScript.
  </code></pre>
  
  <p>What is the issue? I use this code:</p>
  
  <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt;
  &lt;script type="text/javascript"&gt;
      var button;
      var userInfo;
  
      window.fbAsyncInit = function() {
          FB.init({ appId: '154333274632806',
              status: true,
              cookie: true,
              xfbml: true,
              oauth: true});
  
          showLoader(true);
  
          function updateButton(response) {
              button       =   document.getElementById('fb-auth');
              userInfo     =   document.getElementById('user-info');
  
              if (response.authResponse) {
                  //user is already logged in and connected
                  FB.api('/me', function(info) {
                      login(response, info);
                  });
  
                  button.onclick = function() {
                      FB.logout(function(response) {
                          logout(response);
                      });
                  };
              }
              else {
                  //user is not connected to your app or logged out
                  button.innerHTML = 'Login';
                  button.onclick = function() {
                      showLoader(true);
                      FB.login(function(response) {
                          if (response.authResponse) {
                              FB.api('/me', function(info) {
                                  login(response, info);
                              });
                          } else {
                              //user cancelled login or did not grant authorization
                              showLoader(false);
                          }
                      }, {scope:'email,user_birthday,status_update,publish_stream,user_about_me'});
                  }
              }
          }
  
          // Run once with current status and whenever the status changes.
          FB.getLoginStatus(updateButton);
          FB.Event.subscribe('auth.statusChange', updateButton);
      };
      (function() {
          var e = document.createElement('script'); e.async = true;
          e.src = document.location.protocol
              + '//connect.facebook.net/en_US/all.js';
          document.getElementById('fb-root').appendChild(e);
      }());
  
      function login(response, info){
          if (response.authResponse) {
              var accessToken                                =   response.authResponse.accessToken;
  
              userInfo.innerHTML                             = '&lt;img src="https://graph.facebook.com/' + info.id + '/picture"&gt;' + info.name
                                                               + "&lt;br /&gt; Your Access Token: " + accessToken;
              button.innerHTML                               = 'Logout';
              showLoader(false);
              document.getElementById('other').style.display = "block";
          }
      }
  
      function logout(response){
          userInfo.innerHTML                             =   "";
          document.getElementById('debug').innerHTML     =   "";
          document.getElementById('other').style.display =   "none";
          showLoader(false);
      }
  
      //stream publish method
      function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){
          showLoader(true);
          FB.ui(
          {
              method: 'stream.publish',
              message: '',
              attachment: {
                  name: name,
                  caption: '',
                  description: (description),
                  href: hrefLink
              },
              action_links: [
                  { text: hrefTitle, href: hrefLink }
              ],
              user_prompt_message: userPrompt
          },
          function(response) {
              showLoader(false);
          });
      }
  
      function showStream(){
          FB.api('/me', function(response) {
              //console.log(response.id);
              streamPublish(response.name, 'I like the articles of Thinkdiff.net', 'hrefTitle', 'http://thinkdiff.net', "Share thinkdiff.net");
          });
      }
  
      function share(){
          showLoader(true);
          var share = {
              method: 'stream.share',
              u: 'http://thinkdiff.net/'
          };
  
          FB.ui(share, function(response) {
              showLoader(false);
              console.log(response);
          });
      }
  
      function graphStreamPublish(){
          showLoader(true);
  
          FB.api('/me/feed', 'post',
              {
                  message     : "I love thinkdiff.net for facebook app development tutorials",
                  link        : 'http://ithinkdiff.net',
                  picture     : 'http://thinkdiff.net/iphone/lucky7_ios.jpg',
                  name        : 'iOS Apps &amp; Games',
                  description : 'Checkout iOS apps and games from iThinkdiff.net. I found some of them are just awesome!'
          },
          function(response) {
              showLoader(false);
  
              if (!response || response.error) {
                  alert('Error occured');
              } else {
                  alert('Post ID: ' + response.id);
              }
          });
      }
  
      function fqlQuery(){
          showLoader(true);
  
          FB.api('/me', function(response) {
              showLoader(false);
  
              //http://developers.facebook.com/docs/reference/fql/user/
              var query       =  FB.Data.query('select name, profile_url, sex, pic_small from user where uid={0}', response.id);
              query.wait(function(rows) {
                 document.getElementById('debug').innerHTML =
                   'FQL Information: '+  "&lt;br /&gt;" +
                   'Your name: '      +  rows[0].name                                                            + "&lt;br /&gt;" +
                   'Your Sex: '       +  (rows[0].sex!= undefined ? rows[0].sex : "")                            + "&lt;br /&gt;" +
                   'Your Profile: '   +  "&lt;a href='" + rows[0].profile_url + "'&gt;" + rows[0].profile_url + "&lt;/a&gt;" + "&lt;br /&gt;" +
                   '&lt;img src="'       +  rows[0].pic_small + '" alt="" /&gt;' + "&lt;br /&gt;";
               });
          });
      }
  
      function setStatus(){
          showLoader(true);
  
          status1 = document.getElementById('status').value;
          FB.api(
            {
              method: 'status.set',
              status: status1
            },
            function(response) {
              if (response == 0){
                  alert('Your facebook status not updated. Give Status Update Permission.');
              }
              else{
                  alert('Your facebook status updated');
              }
              showLoader(false);
            }
          );
      }
  
      function showLoader(status){
          if (status)
              document.getElementById('loader').style.display = 'block';
          else
              document.getElementById('loader').style.display = 'none';
      }
  
  &lt;/script&gt;
  
  &lt;h3&gt;New JavaScript SDK &amp; OAuth 2.0 based FBConnect Tutorial | Thinkdiff.net&lt;/h3&gt;
  &lt;button id="fb-auth"&gt;Login&lt;/button&gt;
  &lt;div id="loader" style="display:none"&gt;
      &lt;img src="ajax-loader.gif" alt="loading" /&gt;
  &lt;/div&gt;
  
  &lt;br /&gt;
  &lt;div id="user-info"&gt;&lt;/div&gt;
  &lt;br /&gt;
  &lt;div id="debug"&gt;&lt;/div&gt;
  
  &lt;div id="other" style="display:none"&gt;
      &lt;a href="#" onClick="showStream(); return false;"&gt;Publish Wall Post&lt;/a&gt; |
      &lt;a href="#" onClick="share(); return false;"&gt;Share With Your Friends&lt;/a&gt; |
      &lt;a href="#" onClick="graphStreamPublish(); return false;"&gt;Publish Stream Using Graph API&lt;/a&gt; |
      &lt;a href="#" onClick="fqlQuery(); return false;"&gt;FQL Query Example&lt;/a&gt;
  
      &lt;br /&gt;
      &lt;textarea id="status" cols="50" rows="5"&gt;Write your status here and click 'Status Set Using Legacy Api Call'&lt;/textarea&gt;
      &lt;br /&gt;
      &lt;a href="#" onClick="setStatus(); return false;"&gt;Status Set Using Legacy Api Call&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>