I wrote this code to do autocomplete from a PHP array but it is not working, can anybody help?
PHP array:
$cars = array("Volvo", "BMW", "Toyota");
My form:
<form id="frm" method="post">
<input id="cartag" type="text" name="car">
</form>
JS script:
$(function() {
var availableTags = [ <?php echo implode(',', $cars); ?>];
$( "#cartag" ).autocomplete({
source: availableTags
});
});