im using autocomplete of jqueryui (http://jqueryui.com/autocomplete/#remote) and the source comes from "source: "search.php""
This code ...
$( "#name" ).autocomplete({
source: "search.php",
minLength: 2,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.value + " aka " + ui.item.id :
"Nothing selected, input was " + this.value );
}
});
.. And this code below together works perfectly fine! but autocomplete suggest me "All of my Data" ! not smth like my term.
<?php
require('inc/tunel.php');
$keyword = $_POST['keyword'];
$respons = array();
$fetch_engine = $db->query("SELECT name FROM `engine`");
while($read_engine = $fetch_engine->fetch(PDO::FETCH_ASSOC)) {
$respons[] = $read_engine['name'];
}
echo json_encode($respons);
?>
i also tried this code below, my problem solved, but i dont want to see my data in "view source" of my document!
$( "#name" ).autocomplete({
source: <?php
require('inc/tunel.php');
$respons = array();
$fetch_engine = $db->query("SELECT name FROM `engine`");
while($read_engine = $fetch_engine->fetch(PDO::FETCH_ASSOC)) {
$respons[] = $read_engine['name'];
}
echo json_encode($respons);
?>,
minLength: 2,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.value + " aka " + ui.item.id :
"Nothing selected, input was " + this.value );
}
});