Effectivement avec la source ci-dessous ça fonctionne mais pas avec mon fichier php, une idée ?
1 2 3 4 5 6 7
|
source: [
{ value: "article1", refVal: "ref"},
{ value: "article2", refVal: "ref2"},
{ value: "article3", refVal: "ref3"},
{ value: "article4", refVal: "ref4"}
] |
J'ai fais des modifs :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
$q = htmlentities($_GET['query']);
$query=mysql_query("SELECT libelle_article, ref_article FROM article WHERE libelle_article LIKE '%".$q."%' LIMIT 0, 10");
if ( ! $query )
die ('mysql_query error SELECT tiers' . mysql_error());
$json=array();
$return_json=array();
while($row=mysql_fetch_array($query))
{
$row = array_map('utf8_encode', $row);
$critere = $row['ref_article'].' '.$row['libelle_article'].' '.$row['prix_article'];
$json['value'] = $row['libelle_article'];
$json['refVal'] = $row['ref_article'];
array_push($return_json,$json);
}
echo json_encode($return_json);
flush();
exit; |
Pourtant si j'execute seulement le php j'obitens :
[{"value":"ARTICLE TEST","refVal":"ABCD"},{"value":"ASTRA","refVal":"ZYX"}]
Partager