Response title
This is preview!
$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']); }
Then am trying to use collected data like this:
var data=<?php echo json_encode($namesArray);?>;
But it won't work, where could be a problem?
<script>
$(function() {
var data=<?php echo json_encode($namesArray);?>;
$( "#searchTags" ).catcomplete({
options.autocompleteOptions.source = false;
delay: 0,
source: data
});
});
</script>
Is it a PHP problem? Did you include jQuery UI and the catcomplete widget?But it won't work, where could be a problem?
It could just be that stray line of code. But There could be more. And you can find them using the developer tools built into every modern browser.
- $( "#searchTags" ).catcomplete({
- options.autocompleteOptions.source = false;
- delay: 0,
- source: data
- });
foreach($information as $item){
$namesArray=array("label:"=>$item['productTitle'], "category:"=>$item['category']);
}
or here
var data=<?php echo json_encode($namesArray);?>;
© 2013 jQuery Foundation
Sponsored by and others.