Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > JavaScript > Bibliothèques & Frameworks > jQuery
jQuery Forum d'entraide sur le framework jQuery. Avant de poster : Tutoriels jQuery, FAQ jQuery, Tous les tutoriels JavaScript, Toutes les FAQ JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 04/08/2011, 13h22   #1
Rédacteur
 
Avatar de Stessy
 
Homme Stessy Delcroix
Senior Software Engineer JEE
Inscription : avril 2002
Messages : 744
Détails du profil
Informations personnelles :
Nom : Homme Stessy Delcroix
Âge : 37
Localisation : Belgique

Informations professionnelles :
Activité : Senior Software Engineer JEE
Secteur : Finance

Informations forums :
Inscription : avril 2002
Messages : 744
Points : 1 092
Points : 1 092
Par défaut .ajax button onclick 2 clics nécessaires sous FF.

Bonjour à tous,

voilà je vous expose mon problème:

j'ai une fonction qui charge un fichier xml et qui affiche les données dans un table html.

Cette fonction s'exécute correctement sous IE. Mais sous FF je dois cliquer deux fois sur le bouton pour que l'action s'exécute

Code javascript :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function setPicData()
{
    $(function ()
    {
        $('#picButtonId').click(function ()
        {
            $.ajax(
            {
                type : "GET", url : "picData.xml", dataType : "xml", success : function (data)
                {
                    $("#picTableBody").empty();
                    $(data).find('pic').each(function ()
                    {
                        var $pic = $(this);
                        $("#picTableBody").append($('<tr>').append($('<td>').html($pic.find('pic_value').text())).append($('<td>').html($pic.find('legal_name').text())).append($('<td>').html($pic.find('address').text())).append($('<td>').html($pic.find('city').text())).append($('<td>').html($pic.find('country').text())));
                    })
 
                }
            });
 
        });
    })
}

Ai-je manqué quelque chose ??

voici le fichier xml

Code xml :
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
<?xml version="1.0" encoding="UTF-8"?>
<pics>
    <pic>
        <pic_value>961950456</pic_value>
        <legal_name>Dodaro</legal_name>
        <address>via leonardo da Vinci , 53</address>
        <city>Castrolibero</city>
        <country>IT</country>
    </pic>
    <pic>
        <pic_value>963046459</pic_value>
        <legal_name>Viktimolosko drustvo Srbije</legal_name>
        <address>Dositejava, 1A</address>
        <city>Belgrade</city>
        <country>RS</country>
    </pic>
    <pic>
        <pic_value>968427825</pic_value>
        <legal_name>80G, SA</legal_name>
        <address>Rua do Moinho, -</address>
        <city>Lourinhã</city>
        <country>PT</country>
    </pic>
    <pic>
        <pic_value>968764124</pic_value>
        <legal_name>A.Davis t/a Lighthouse Design &amp; Marketing</legal_name>
        <address>4 Long Row, -</address>
        <city>King's Lynn</city>
        <country>UK</country>
    </pic>
    <pic>
        <pic_value>963404389</pic_value>
        <legal_name>Bangladesh Fisheries Research Forum</legal_name>
        <address>House#354, Ground Floor, New DOHS, , Road#27</address>
        <city>Mohakhali, Dhaka</city>
        <country>BD</country>
    </pic>
    <pic>
        <pic_value>968988194</pic_value>
        <legal_name>PECHEURS DU NORD ET MANCHE</legal_name>
        <address>rue du commandant Charcot, 16</address>
        <city>Boulogne-sur-Mer</city>
        <country>FR</country>
    </pic>
    <pic>
        <pic_value>991008067</pic_value>
        <legal_name>Technologie-Lizenz-Büro der Baden-Württembergischen
                    Hochschulen GmbH</legal_name>
        <address>Ettlinger Strasse, 25</address>
        <city>Karlsruhe</city>
        <country>DE</country>
    </pic>
    <pic>
        <pic_value>991011753</pic_value>
        <legal_name>PRODUITS CHIMIQUES AUXILIAIRES ET DE SYNTHESE SA</legal_name>
        <address>RUE BOSSUET, ZI DE LA VIGNE AUX LOUPS , 23</address>
        <city>LONGJUMEAU</city>
        <country>FR</country>
    </pic>
    <pic>
        <pic_value>991011850</pic_value>
        <legal_name>THALES SECURITY SOLUTIONS &amp; SERVICES SAS</legal_name>
        <address>Rue Grange Dame Rose, 20-22</address>
        <city>VELIZY-VILLACOUBLAY</city>
        <country>FR</country>
    </pic>
</pics>

Merci à tous pour votre aide
__________________
Langages : Java, SQL
Outils : Eclipse, Intellij
SGBD : Oracle, PostgreSQL
Mes Articles
Stessy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/08/2011, 14h04   #2
Membre habitué
 
Inscription : septembre 2009
Messages : 85
Détails du profil
Informations personnelles :
Âge : 22
Localisation : France, Isère (Rhône Alpes)

Informations forums :
Inscription : septembre 2009
Messages : 85
Points : 101
Points : 101
[débutant]
Est ce que ca marche en enlevant tes deux fonction avant $('#picButtonId').click(function (...)) ?

Edit: ah bah Bovino a mieux formulé ma pensée :p
gototog est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/08/2011, 14h05   #3
Responsable Développement Web

 
Avatar de Bovino
 
Homme Didier Mouronval
Développeur Web
Inscription : juin 2008
Messages : 13 807
Détails du profil
Informations personnelles :
Nom : Homme Didier Mouronval
Âge : 41
Localisation : France, Gironde (Aquitaine)

Informations professionnelles :
Activité : Développeur Web
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : juin 2008
Messages : 13 807
Points : 35 797
Points : 35 797
Pourquoi mettre le code dans une fonction setPicData() ?
D'ailleurs, quand est-elle appelée cette fonction ?
__________________
Pas de question technique par MP !
Tout le monde peut participer à developpez.com, vous avez une idée, contactez-moi !
Vous possédez un blog et aimeriez diffuser vos billets sur le forum, contactez-moi !
Mes formations video2brain : La formation complète sur JavaScriptJavaScript et le DOM par la pratiquePHP 5 et MySQL : les fondamentaux
Mon livre sur jQuery
Bovino est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/08/2011, 14h13   #4
Rédacteur
 
Avatar de Stessy
 
Homme Stessy Delcroix
Senior Software Engineer JEE
Inscription : avril 2002
Messages : 744
Détails du profil
Informations personnelles :
Nom : Homme Stessy Delcroix
Âge : 37
Localisation : Belgique

Informations professionnelles :
Activité : Senior Software Engineer JEE
Secteur : Finance

Informations forums :
Inscription : avril 2002
Messages : 744
Points : 1 092
Points : 1 092
Merci Bovino, problème résolu.

Simplement viré le code de la fonction getPicData();

Toujours l'art de travailler à l'ancienne comme si jquery n'existait pas.

Code javascript :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 $(document).ready(function ()
    {
        $('#picButtonId').click(function ()
        {
            $.ajax(
            {
                type : "GET", url : "picData.xml", dataType : "xml", success : function (data)
                {
                    $("#picTableBody").empty();
                    $(data).find('pic').each(function ()
                    {
                        var $pic = $(this);
                        $("#picTableBody").append($('<tr>').append($('<td>').html($pic.find('pic_value').text())).append($('<td>').html($pic.find('legal_name').text())).append($('<td>').html($pic.find('address').text())).append($('<td>').html($pic.find('city').text())).append($('<td>').html($pic.find('country').text())));
                    })
 
                }
            });
 
        });
    });
__________________
Langages : Java, SQL
Outils : Eclipse, Intellij
SGBD : Oracle, PostgreSQL
Mes Articles
Stessy est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 10h35.


 
 
 
 
Partenaires

Hébergement Web