Here is the part of my Javascript:
$(function(){
var dbTags=<?php echo json_encode($namesArray);?>;
var myTag;
$("#searchTags").autocomplete({
source: dbTags,
minLength: 2,
select: function(event, ui){
myTag=ui.item.value;
My php code:
$findNames=$user_home->runQuery("SELECT productTitle, category from Iranga ");
$findNames->execute();
$information=$findNames->fetchAll(PDO::FETCH_ASSOC);
foreach($information as $item){
$namesArray=array("label:"=>$item['productTitle'], "category:"=>$item['category']);
}
Am planning to use this script: https://jqueryui.com/autocomplete/#categories
The question how to use and define my dbTags variable, when it contains product tilte and categories?