title: jQuery Ajax Success get returned Array Length?
body: <p>I'm trying to loop the returning Array from <code>PHP</code>. But jQuery <code>.length</code> is giving me:</p>
  
  <pre><code>'undefined'
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>$items = array();
  $items["country"] = "North Korea",
  $items["fruits"] = array(
                        "apple"=&gt;1.0,
                        "banana"=&gt;1.2,
                        "cranberry"=&gt;2.0,
                      );
  echo json_encode( $fruits );
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>$.ajax({
      url: "items.php",
      async: false,
      type: "POST",
      dataType: "JSON",
      data: { "command" : "getItems" }
  }).success(function( response ) {
      alert( response.fruits.apple );
      alert( response.length );
  });
  </code></pre>
  
  <ul>
  <li>Here the First Alert() is ok, by returning: <code>"1.0"</code>.</li>
  <li>Then the Second Alert() to detect length <code>response.length</code> is returning:
  <ul>
  <li><code>undefined</code></li>
  </ul></li>
  </ul>
  
  <p>Then how can i loop this Array (or) how to loop the Fruits (defined by PHP like <code>$items["fruits"]</code>) from jQuery end please?</p>