title: php json jquery and select box
body: <p>I have this php code</p>
  
  <pre><code>$jsonArray = array();
  $sql = "SELECT ID,CLIENT FROM PLD_SERVERS";
  $result = mysql_query($sql);
  while($row = mysql_fetch_array($result)) {
      $jsonArray[] = array('id'=&gt;$row['ID'],'client'=&gt;$row['CLIENT']);
  }
  echo json_encode($jsonArray);
  </code></pre>
  
  <p>And this js</p>
  
  <pre><code>function autosearchLoadServers()
  {
  
    $.post("php/autosearch-load-servers.php",function(data){
        var toAppend = "";
        for(var i = 0; i &lt; data.length; i++){
            toAppend += '&lt;option value = \"' + data[i].id + '\"&gt;' + data[i].client + '&lt;/option&gt;';
        }
        $("#serverSelect").empty();
        $("#serverSelect").html(toAppend);
    });
  
  }
  </code></pre>
  
  <p>The problem is that i get only undefined values. How can this be? The values are in the JSON, i checked using firebug in mozilla so there has to be something with the data variable but i can't understand what. I tried different ways and no results.</p>