title: XMLHttpRequest sometimes doesn't send string
body: <p>I'm not sure why this is happening but I will try to explain as much as I already know.
  I have a website that allows you to log in with an account stored on a database. Each user can update their own set of data that is also in the same database. 
  When a user changes data Javascript will post an XMLHttpRequest to a php file on the server. The data is JSON encoded and is decoded in the php file and then stores the data on the database.</p>
  
  <p>The problem is whenever I log into a specific account no data is sent. The string is empty after the request is sent. The post works and the php file runs but no data is present. Here is my code for sending the request in JS:</p>
  
  <pre><code>function sendXMLHttpRequest(data, phpfile){
  
      var xhr;
  
      if (window.XMLHttpRequest) {
          xhr = new XMLHttpRequest();
      }
      else if (window.ActiveXObject) {
          xhr = new ActiveXObject("Msxml2.XMLHTTP");
      }
      else {
          throw new Error("Ajax is not supported by this browser");
      }
  
      xhr.open('POST', phpfile, true);
      xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  
      xhr.onreadystatechange = function () {
          if (xhr.readyState === 4) {
              if (xhr.status === 200) {
  
                  if (this.responseText !== null)
                      document.getElementById('saveresponse').innerHTML = xhr.responseText;
                  else
                      alert("Ajax error: No data received");
              }else alert("Ajax error: " + this.status);
          }
      };
  
      xhr.send(data);
  
  }
  </code></pre>
  
  <p>On the php side:</p>
  
  <pre><code>session_start();
  
  $mysql = new Mysql();
  
  $data = json_decode($_POST['stringData']);
  echo 'Data: ' . $data . "&lt;br /&gt;";
  </code></pre>
  
  <p>Normally when I echo the data is returns <code>Array</code> which is what I want but it doesn't echo anything when ever I log into this one specific account, the data sent is just a string where <code>stringData</code> is a JSON. Is there a way to see if anything IS stored there? Also if nothing is being sent why could this be? Any suggestions for my code?</p>