IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

AJAX Discussion :

[AJAX] Dom et Ajax


Sujet :

AJAX

  1. #1
    Membre très actif
    Homme Profil pro
    ray man
    Inscrit en
    Juillet 2009
    Messages
    274
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : ray man

    Informations forums :
    Inscription : Juillet 2009
    Messages : 274
    Par défaut [AJAX] Dom et Ajax
    Je travail dans une petite application J'ai une page php contient seci


    tab.php
    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
     
    <?php
      header("Content-Type: text/xml");
    echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
    echo "<list>";
     
    $idEditor = (isset($_POST["IdEditor"])) ? htmlentities($_POST["IdEditor"]) : NULL;
     
    if ($idEditor) {
            include_once 'AccB.php';
                   $Acc=new AccB();
                   $re="select * from `enfants` where `NumEnreg`=$idEditor;";
                   $Exr=$Acc->Select($re);
                   while($Lir=$Exr->fetch())
                   {
     
                    echo "<item id='$Lir[0]' NomFamille='$Lir[1]' prenomEnfnat='$Lir[2]' prenomEnfnat='$Lir[3]' Age='$Lir[4]'  Fonction='$Lir[5] Tel='$Lir[6] DomicileACtuel='$Lir[8]' Sexe='$Lir[9]' SutuationFamillier='$Lir[10]' Datemariage='$Lir[11]' Photo='$Lir[12]' la9Ab='$Lir[13]' />";
                   }
    }
     
    echo "</list>";
     
    ?>

    et dans la page qui contient la fonction appel tap.php J'ai sa

    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
    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
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
     
    function tab(oSelect) {
    	var value = oSelect.options[oSelect.selectedIndex].value;
    	var xhr   = XMLHttpRequest();
     
    	xhr.onreadystatechange = function()
            {
    		if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0))
                            readtab(xhr.responseXML);
    	};
     
    	xhr.open("POST", "tab.php", true);
    	xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    	xhr.send("IdEditor=" + value);
    }
     
    function readtab(oData) {
    	var nodes   = oData.getElementsByTagName("item");
    	var oSelect = document.getElementById("d");
    	var oOption, oInner2,otd1,otd2,oInner1;
     
    	oSelect.innerHTML = "";
    	for (var i=0, c=nodes.length; i<c; i++) {
    		oOption = document.createElement("tr");
     
                    var otd11=document.createElement("td");
                    var oInner11  = document.createTextNode("id");
                    var otd12=document.createElement("td");
                    var oInner12  = document.createTextNode(nodes[i].getAttribute("id"));
                    otd11.appendChild(oInner11);
                    otd12.appendChild(oInner12);
                    oOption.appendChild(otd11);
                    oOption.appendChild(otd12);
     
     
                    var otd21=document.createElement("td");
                    var oInner21  = document.createTextNode("NomFamille");
                    var otd22=document.createElement("td");
                    var oInner22  = document.createTextNode(nodes[i].getAttribute("NomFamille"));
                    otd21.appendChild(oInner21);
                    otd22.appendChild(oInner22);
                    oOption.appendChild(otd21);
                    oOption.appendChild(otd22);
     
    		oSelect.appendChild(oOption);
    	}
    }
     
     
    //-->
    </script>
     
     
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title></title>
        </head>
        <body>
            <select id="editorsSelect" onchange="request(this);">
    			<option value="none">Selection</option>
            <?php
                   include_once 'AccB.php';
                   $Acc=new AccB();
                   $re="select * from rue";
                   $Exr=$Acc->Select($re);
                   while($Lir=$Exr->fetch())
                   {?>
                       <option value="<?php echo $Lir[0]; ?>"> <?php echo $Lir[1]; ?></option>
                   <?php }?>
            </select>
     
            <select id="softwaresSelect" onchange="requestt(this);"></select>
     
            <select id="EnfantsSelect" onchange="tab(this);"></select>
     
            <table id="d" border="2">
     
            </table>

    tout les fonction request marche a merveille mais la fonction tab marche pas

    Cordialement Ryodo

  2. #2
    Rédacteur/Modérateur
    Avatar de andry.aime
    Homme Profil pro
    Inscrit en
    Septembre 2007
    Messages
    8 391
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Ile Maurice

    Informations forums :
    Inscription : Septembre 2007
    Messages : 8 391

  3. #3
    Membre très actif
    Homme Profil pro
    ray man
    Inscrit en
    Juillet 2009
    Messages
    274
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : ray man

    Informations forums :
    Inscription : Juillet 2009
    Messages : 274
    Par défaut Solution de mon probléme
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    var newRow = document.getElementById('d').insertRow(-1);
                    var newCell = newRow.insertCell(0);
                    newCell.innerHTML = "Sutuation Famillier";
                    newCell = newRow.insertCell(1);
                    newCell.innerHTML = nodes[i].getAttribute("SutuationFamillier");
    Cordialement Ryodo

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Prototype] [DOM] ajax.updater() ou ajax.request()
    Par wincroc dans le forum Bibliothèques & Frameworks
    Réponses: 5
    Dernier message: 13/06/2007, 11h26
  2. [AJAX] [DOM] Retarder declenchement événement
    Par Fabouney dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 21/02/2007, 20h01
  3. [AJAX] appel Ajax DOM
    Par MALAGASY dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 28/09/2006, 13h16
  4. [AJAX] DOM et responseXML
    Par julienr dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 14/05/2006, 16h07
  5. [Ajax]Dom et FirstChild
    Par ..:: Atchoum ::.. dans le forum Général JavaScript
    Réponses: 6
    Dernier message: 07/05/2006, 22h49

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo