I have the following script
<script type="text/javascript">
$().ready(function() {
$("#course").autocomplete("teste1.php", {
width: 260,
matchContains: true,
selectFirst: false
});
});
</script>
What gets the return from here:
$q = strtolower($_GET["q"]);
if (!$q) return;
list($resultados,$quantidade) = $select->selectTable('f_tb_empresas','id_empresa,nm_empresa',NULL,"nm_empresa LIKE '%".$q."%'",NULL);
foreach ($resultados as $row) {
$linha['value'] = $row['nm_empresa'];
$linha['id'] = $row['id_empresa'];
}
echo json_encode($linha);
And the result comes to input
:
<input type="text" name="course" id="course" />
The result looks like this: {"value":"Alameda dos anjos","id":"39"}
, but I wanted the id to be one input and value to another.
How do I do this with JQuery?
Thank you