title: How to feed the json value in text box using jQuery AutoComplete?
body: <p>I have the following value representation of an actual JSON object returned from my controller:</p>
  
  <p>script:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var customers = [{"name":"Urban Development","id":1},{"name":"Ball Corporation","id":2},{"name":"Apache Software Foundation","id":3},{"name":"The Coca-Cola Company","id":4},{"name":"Discovery Communications, Inc.","id":5},{"name":"Electronic Data Systems","id":6},{"name":"FreeWave Technologies, Inc.","id":7}] ;
      $("#customer").autocomplete({ source: customers });
  &lt;/script&gt;  
  </code></pre>
  
  <p>html: </p>
  
  <pre><code>&lt;label for="customer"&gt;Customer Name&lt;/label&gt;
  &lt;input type="text" name="customer" id="customer" &gt;
  </code></pre>
  
  <p>I dont know how to do this so any1 can help me.</p>
  
  <p><strong>Updated</strong>
  Model page</p>
  
  <pre><code>public function getEmp(){
  $db = Loader::db();     
  return $db-&gt;GetArray("select emp_id, emp_name as label, emp_name as value, emp_doj from employee_master");}
  </code></pre>
  
  <p>Controller page</p>
  
  <pre><code>$employee = employeeinfo::getEmp();
  $this-&gt;set('employee', $employee);
  </code></pre>
  
  <p>view page
   script</p>
  
  <pre><code>$(function() {
  var dataEmp = &lt;?php echo json_encode($employee); ?&gt;;
  
  /* my json value like this
  [
  {"id": "2","label": "S Kumar ","value": "S Kumar ","emp_doj": "2013-07-02"}, 
  {"id": "3","label": "Cj Ramki ","value": "Cj Ramki ","emp_doj": "2013-07-03"}, 
  {"id": "4","label": "V Sudarsanam","value": "V Sudarsanam","emp_doj": "2011-06-06"}, 
  {"id": "9","label": "S Kamal","value": "S Kamal", "emp_doj": "2013-07-17"},
  {"id": "15","label": "R Malani","value": "R Malani","emp_doj": "2014-01-03"}
  ];*/
  $( "#pAdminName" ).autocomplete({ 
      source: dataEmp,
      minLength: 1,
      select: function( event, ui ) {
          $( "#hd" ).val( ui.item.emp_id );
          return false;
      }       
  });
  });
  </code></pre>
  
  <p>html</p>
  
  <pre><code>&lt;?php echo $form-&gt;text('pAdminName',$pAdminName,array('placeholder'=&gt;'Enter or select a name from list')) ?&gt;
  &lt;input type="hidden" id="hd" name="hd" /&gt;
  </code></pre>