Bonjour à tous,

J'ai un problème, j'ai écrit une fonction php-ajax pour récupérer des valeurs d'une requête sql par ajax avec de l'XML.

Cette fonction fonctionne très bien en local, par contre, si je l'installe sur le serveur web public ça ne fonctionne plus...

Après avoir testé avec FireBug, ce serait juste la récupération du XML qui ne fonctionne pas (si je récupère uniquement le texte en mettant la variable XML à false dans l'appel, j'ai bien toutes les balies et réponses XML)

Pour info:
Ma fonction JavaScript est: (le problème est dans la réponse, même l'alert ne marche pas...(j'ai essayé avec et sans))

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
function ModifClient()
{
document.getElementById("titreclient").innerHTML = "Modification d'un client";
AnnulerEntree();
returnValue =0;
var rads = document.getElementsByName("IDClient");
  for(var rad in rads) {
    if(rads[rad].checked)
      returnValue = ( rads[rad].value);
  }
if (returnValue==0){
alert ("Vous devez sélectionner un client");
}
else{
param = "ajaxval=modifentree&ajoutIDClient="+returnValue;
ajax("POST","testsql",param,ModifEntree_OK,true);
}
}
function ModifEntree_OK(reponse)
{
alert (reponse.getElementsByTagName('Nom').item(0).firstChild.data);
if (reponse.getElementsByTagName('Nom').item(0).firstChild) document.getElementById("ajoutNom").value = reponse.getElementsByTagName('Nom').item(0).firstChild.data;
 
if (reponse.getElementsByTagName('Prenom').item(0).firstChild) document.getElementById("ajoutPrenom").value = reponse.getElementsByTagName('Prenom').item(0).firstChild.data;
 
...

Mon fichier PHP est: (j'ai essayé avec et sans la ligne echo "'<?xml version="1.0" encoding="utf-8"?>';"

Code php : Sélectionner tout - Visualiser dans une fenêtre à part
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
if ($ajaxval == 'modifentree')
{
header("content-type: application/xml");
echo '<?xml version="1.0" encoding="utf-8"?>';
$IDClient11 = $_POST['ajoutIDClient'];
$req1 = mysql_query("SELECT * from client where IDClient = " . $IDClient11);
if (@mysql_num_rows($req1) != 0)
{
while($data = mysql_fetch_assoc($req1)) 
{
$_SESSION['ClientModif'] = $data['IDClient'];
echo "<reponse>
                  <Nom>".$data['Nom']."</Nom>
                   <Prenom>".$data['Prenom']."</Prenom>
                   <Rue>".$data['Rue']."</Rue>
                   <Numero>".$data['Numero']."</Numero>
                   <Bte>".$data['Bte']."</Bte>
                   <CP>".$data['CP']."</CP>
                   <Localite>".$data['Localite']."</Localite>
                   <Tel>".$data['Tel']."</Tel>
                   <GSM>".$data['GSM']."</GSM>
                   <EMail>".$data['EMail']."</EMail>
                   <Langue>".$data['Langue']."</Langue>
                   <Proprietaire>".$data['Proprietaire']."</Proprietaire>
                   <LogementSocial>".$data['LogementSocial']."</LogementSocial>
                   <AccordProprietaire>".$data['AccordProprietaire']."</AccordProprietaire>
                   <TypeHabitation>".$data['TypeHabitation']."</TypeHabitation>
                   <Distance>".$data['Distance']."</Distance>
                   <ConfigInternet>".$data['ConfigInternet']."</ConfigInternet>
                   <PowerPlugDuo>".$data['PowerPlugDuo']."</PowerPlugDuo>
                   <PowerPlugSup>".$data['PowerPlugSup']."</PowerPlugSup>
                   <LivraisonPack>".$data['LivraisonPack']."</LivraisonPack>
                   <Commentaires>".$data['Commentaires']."</Commentaires>
<statut>".$data['Statut']."</statut>";
if ($data['DatePlanifiee']){
$ajoutPlanifiee_explosee = explode("-", $data['DatePlanifiee']);
$annee1 = $ajoutPlanifiee_explosee[0];
$mois1 = $ajoutPlanifiee_explosee[1];
$jour1 = $ajoutPlanifiee_explosee[2];
echo "<planifiee>".$jour1."/".$mois1."/".$annee1."</planifiee>";
}
else
{
echo "<planifiee></planifiee>";
}
echo "<installateur>".$data['IDInstallateur']."</installateur>
<Vendeur>".$data['IDVendeur']."</Vendeur>
         </reponse>" ;
}
}
}

Voilà, si vous avez une idée Merci d'avance!