J'ai un problème avec l'autocomplétion je n'ai aucune erreur console avec ce code
Code : Tout sélectionner
<link rel="stylesheet" href="css/jquery-autocomplete.css" >
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"></script>
<input id="tags" value="search">
<script>
$(document).ready(function() {
$( "#tags" ).autocomplete({
source: function( request, response ) {
$.ajax({
url: "fichier.php",
dataType: "json",
data: {
term: request.term
},
success: function( data ) {
response( data );
}
});
},
minLength: 1
});
});
</script>Code : Tout sélectionner
<?php
if(isset($_GET['term'])) {
include_once('Connexion/ldap_connexion.php');
$q = htmlentities($_GET['term']);
$ldapConn = ldap_connect($ldapServer ) or $error_ldap_connect = true;
$query = "(|(sn=$q*)(givenname=$q*)(mail=$q*)(login=$q*))";
ldap_set_option($ldapConn,LDAP_OPT_PROTOCOL_VERSION,3);
ldap_set_option($ldapConn,LDAP_OPT_REFERRALS,0);
$ldapBind = ldap_bind($ldapConn,$rdn,$mdp);
$ldapResult = ldap_search($ldapConn,$baseDN,$query);
$info = ldap_get_entries($ldapConn,$ldapResult);
$Json = array();
for ($i=0; $i < $info ["count"]; $i++)
{
$Json[$i]['prenom'] = $info[$i]["givenname"][0] ;
$Json[$i]['nom'] = $info[$i]["sn"][0];
$Json[$i]['mail'] = $info[$i]["mail"][0];
$Json[$i]['login'] = $info[$i]["samaccountname"][0];
}
ldap_unbind($ldapConn);
echo json_encode($Json);
header("Content-Type: application/json");
}
?>Code : Tout sélectionner
$Json = array("first", "second", "third");Merci de votre aide.
