autocomplete issues

autocomplete issues

I've searched this site, stackoverflow and general web searches looking at different tutorials and I'm still stuck.

I have some simple Html:
<label
for="companyName">Company Name:&nbsp;
<input
id="autocomplete-companyName" name="companyName" type="text" size="36" maxlength="72" value="" /> </label>

JavaScript:

(document).ready( function() {
      $('#autocomplete-companyName').val('');
      $('#autocomplete-companyName').autocomplete({
      source:'includes/autoCompleteFunctions.php',
      minLength:2 }); });


and PHP:
$term
= trim(strip_tags($_GET['term']));
$autofillQuery_companyNames = "SELECT company_name AS value, 
      quote_index AS label FROM quote_numbers
      WHERE company_name LIKE '%" . $term . "%' ";

$results

= mysqli_query($con, $autofillQuery_companyNames) ;
$return_array
= array(); while ($row = mysqli_fetch_array(
      $results, MYSQL_ASSOC )) { // loop through the retrieved values
 
$row

['value'] = htmlentities(stripslashes($row[ 'value' ]));
$row
['id'] = htmlentities(stripslashes($row[ 'label' ]));
array_push
($return_array, $row); }
echo json_encode
( $return_array );

This php will print the following out on the web page,
but I can't get it into the autocomplete field on my form.




JSON DATA:
[{"value":"CSI","label":"1001"},{"value":"PLaG","label":"1002"}]



I think I'm mis-understanding how to take the returned data
and display it. Can anyone help?