title: Uncaught SyntaxError: Unexpected token u in json
body: <p>I have read online that the unexpected token issue can come from using <code>JSON.parse()</code>. </p>
  
  <p>I am getting this error <code>Uncaught SyntaxError: Unexpected token u</code></p>
  
  <p>What I am doing wrong?</p>
  
  <p>My code look like this</p>
  
  <pre><code>var t=null;
  var xmlhttp=new XMLHttpRequest();
  xmlhttp.onreadystatechange=function(responseText)
  {
      if (xmlhttp.readyState == 4 &amp;&amp;xmlhttp.status==200)
      var obj = JSON.parse(xmlhttp.responseText);
      var str=JSON.stringify(obj);
      var newArr = JSON.parse(str);
      var len=newArr.length;
      $.mobile.pageContainer.pagecontainer( "change","sales_home.html");
      $(document).on('pageshow', "#temp", function (event, data) {
          while (len &gt; 0) {
  
            len--;
          }
      });
  }
  xmlhttp.onerror=function(E)
  {
      alert("error"+ E);
  }
  xmlhttp.open("GET","url",true);
  xmlhttp.send();
  </code></pre>