title: Why is array.length returning me wrong number?
body: <p>This is my javascript code in which I am calling a php file each 5 seconds ,the php file returns some id's in form of javascript array but array.length is giving me 18 while there are only 2 elements in the array.</p>
  
  <p>PHP file response:</p>
  
  <pre><code>["20","1"]
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>//function to rotate thumbnails
    window.setInterval(function () {    
              var xmlhttp = new XMLHttpRequest();
          xmlhttp.onreadystatechange = function() {
              if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
                  var index;
                  var a = xmlhttp.responseText;
                  for (index = 0; index &lt; a.length; index++) {
                      pass_value_to_other_function(a[index]);
                  }               
              }
          }
          xmlhttp.open("GET", "thumb_rotator.php", true);
          xmlhttp.send();
      }, 5000);
  </code></pre>