title: autocomplete source from php file
body: <p>I'm quite newbie in JSON, just started it the last night, I'm very close to the deadline of a project, I used xml, and tried now to switch to json.
  I started with the simplest representation of a json object, let me go to code:</p>
  
  <p>PHP Code:</p>
  
  <pre><code>&lt;?php
  //phpPage.php
  $json = array();
  $json[]='Jquery';
  $json[]='AJAX';
  $json[]='JSON';
  //for example
  
  echo json_encode($json);
  ?&gt;
  </code></pre>
  
  <p>js code:</p>
  
  <pre><code>$(document).ready(function(){  
    $.post('phpPage.php', { /*no matter*/ }, showResult, "text");  
  });
  
  function showResult(res){
    var obj = JSON.parse(res);
    $("input#autocomplete").autocomplete({
      source: function() {
          var rows = new Array();
          for(var i=0; i&lt;3; i++){//Assume that I know array size, skip it
              //what to do here?
          }
          return rows;
      }
    });
  }
  </code></pre>
  
  <p>I don't know how to convert the sent object to an array ready to be used in the 'source' of the autocomplete.
  Thanks for your time,
  Regards!</p>
  
  <p>The solution:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function(){  
    $.post('phpPage.php', { /**/ }, showResult, "text");  
  });
  
  function showResult(res){
    var obj = JSON.parse(res);
    $("input#autocomplete").autocomplete({
      source: obj
    });
  }
  &lt;/script&gt;
  </code></pre>