je suis occupé sur une recherche avec autocompletion , je que je voudrai c'est que liste soit cliquable et me renvois vers une fiche d'information avec le détail avec ce lien :
location.href = '/Fiche/Fiche.php?solution=' + id;
Mais j'ai toujours et je n'arrive pas à trouver mon erreur : No search results
Merci d'avance pour votre aide
Ma page Index :
[javascript]
<!-- ############## AUTO COMPLETE ######################-->
<script src="js/jquery.ui.autocomplete.html.js"/></script>
<script src="js/jquery.autocomplete.js"/></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery ... /></script>
<script type="text/javascript">
$(document).ready(function($){
$('#Autocomplte').autocomplete({
source:'AUTO_COMPLETE.php',
minLength:4,
select: function(event,ui){
var id = ui.item.id;
if(id != '') {
location.href = '/Fiche/Fiche.php?solution=' + id;
}
},
// optional
html: true,
// optional (if other layers overlap the autocomplete list)
open: function(event, ui) {
$(".ui-autocomplete").css("z-index", 1000);
}
});
});
</script>
[/javascript]
HTML
<!-- ###### SYSTEME DE RECHERCHE PAR AUTO COMPLETE ###### -->
<form action="" method="post">
<input type="text" placeholder="Titre" id="Autocomplte" class="ui-autocomplete-input" autocomplete="off" />
</form>
<!--######################################################-->
Mon fichier php
<?php
// Informations de la base de donnée
$mysql_acces_host = '127.0.0.1';
$mysql_acces_user = 'user ';
$mysql_acces_password = 'password ';
$mysql_bdd = 'bdd';
mysql_connect("$mysql_acces_host", "$mysql_acces_user", "$mysql_acces_password");
mysql_select_db("$mysql_bdd");
// REQUETE //
$requete = mysql_query("SELECT * FROM test WHERE solution LIKE '%$term%' or format LIKE '%$term%' ORDER BY solution,format");
$liens = mysql_num_rows($requete);
while( $liens = mysql_fetch_array($requete)){
//while($row = mysqli_fetch_array($data)) {
$solution = htmlentities(stripslashes($row['solution']));
$format = htmlentities(stripslashes($row['format']));
$id = htmlentities(stripslashes($row['id']));
$a_json_row["id"] = $id;
$a_json_row["value"] = $solution.' '.$format;
$a_json_row["label"] = $solution.' '.$format;
array_push($a_json, $a_json_row);
}
/* jQuery wants JSON data */
echo json_encode($a_json);
flush();
$mysqli->close();
?>