Probléme d'identifiction avec Ajax
sou1987
Messages postés
52
Statut
Membre
-
sou1987 Messages postés 52 Statut Membre -
sou1987 Messages postés 52 Statut Membre -
Bonjour,
j 'essai de récupérer la valeur responseXML à partir d'un fichier php comme suit
echo '<?xml version="1.0" ?>'
echo "<root><per>hjhjh</per></root>"
firefox affiche
instruction de traitement XML ou texte pas au début d'une entité externe
j 'essai de récupérer la valeur responseXML à partir d'un fichier php comme suit
echo '<?xml version="1.0" ?>'
echo "<root><per>hjhjh</per></root>"
firefox affiche
instruction de traitement XML ou texte pas au début d'une entité externe
A voir également:
- Probléme d'identifiction avec Ajax
- Shoutbox avec ajax - Forum Javascript
- Yggtorrent erreur ajax ✓ - Forum PHP
- Erreur ajax c est quoi ✓ - Forum PHP
- Easyphp ajax ✓ - Forum PHP
- Ajax ne fonctionne pas... ? - Forum Programmation
4 réponses
voila la page.js d'ajax
function resul()
{
if(xhr.readyState==4){
if(xhr.status==200)
{
var root=xhr.responseXML;alert(root);
root=root.getElementsByTagName("title").item(0);
root=root.firstChild.nodeValue;
document.getElementById("id1").className="visible";
document.getElementById("id1").innerHTML=root;
}
}
}
et dans .php
$ch1="salam";
echo '<?xml version="1.0" encoding="iso-8859-1" ?>';
echo"<root>
<dispo id=\"message\">$ch1</dispo>
</root>";
normalement dans la page.html dans la balise div j aurais "salam"
mais ça marche pas
function resul()
{
if(xhr.readyState==4){
if(xhr.status==200)
{
var root=xhr.responseXML;alert(root);
root=root.getElementsByTagName("title").item(0);
root=root.firstChild.nodeValue;
document.getElementById("id1").className="visible";
document.getElementById("id1").innerHTML=root;
}
}
}
et dans .php
$ch1="salam";
echo '<?xml version="1.0" encoding="iso-8859-1" ?>';
echo"<root>
<dispo id=\"message\">$ch1</dispo>
</root>";
normalement dans la page.html dans la balise div j aurais "salam"
mais ça marche pas
root=root.getElementsByTagName("title").item(0);Ça commence déjà mal : tu n'as aucun élément "title" dans ton XML