Partage
  • Partager sur Facebook
  • Partager sur Twitter

problème actualisation jquery

    9 février 2010 à 15:45:45

    Bonjour à tous,

    Voici mon problème, sur ma page de démarrage j'ai un bouton qui lance ma fonction JavaScript test().

    Cette fonction appel une page PHP qui me crées un tableau avec les donner d'une BDD, ma fonction ouvre bien le fichier PHP et fait bien mon tableau, mais le souci c'est qu'il ne m'affiche pas le résultat dans le div dédier a cela.

    Mais voilà quand j'appuis tous simplement sur le bouton actualiser comme par magie il m'affiche mon résultat et aussitôt il l'efface.

    fonction test()
    function test(){
    	$.ajax({
    		type: "POST",
    		url: "analyse.php",
    		async: false,
    		success: function(result){
    			$("#resultat").html(result);
    		}
    	});
    }
    


    Ca va faire une petite aprem que je suis dessus et je commence à fatiguer.

    Je vous remercie d'avance
    • Partager sur Facebook
    • Partager sur Twitter
      9 février 2010 à 16:12:45

      Il va nous falloir le reste du code :/
      Un exemple en ligne serait même encore mieux :)
      • Partager sur Facebook
      • Partager sur Twitter
        10 février 2010 à 9:43:35

        voici ma page qui appel ma fonction :
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        
        <html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
        
        <head>
        <title>SPEinspector</title>
        <meta http-equiv="Content-Type" content="text/HTML; charset=utf-8" />
        <meta http-equiv="Content-Script-Type" content="text/javascript" />
        <meta http-equiv="Content-Style-Type" content="text/css" />
        <meta http-equiv="Content-Language" content="fr" />
        <link rel="shortcut icon" type="images/x-icon" href="favicon.ico" />
        <link rel="stylesheet" type="text/css" href="css/base.css" media="all" />
        <link rel="stylesheet" type="text/css" href="css/screen.css"
        	media="screen" />
        <script type="text/javascript"
        	src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
        <script type="text/javascript"
        	src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
        <script type="text/javascript"
        	src="js/inspector.js"></script>
        </head>
        
        <body id="homepage">
        <div class="page">
        <h1>SPE<span>inspector</span></h1>
        <div class="launch">
        <p class="button01 main"><a class="maxbutton" href="" onclick="test();">Lancer
        l'inspecteur</a></p>
        <p class="secondary">Dernière exécution : jeudi 21 janvier 2010 à
        10:19 - 817 sites analysés - 4 erreurs</p>
        </div>
        <!-- /launch -->
        <div id="resultat">
        </div>
        </div>
        <!-- /page -->
        </body>
        
        </html>
        


        et voici ma page appeler dan la fonction :

        <?php
        include "fonction/function.php";
        include "conf/sql.conf.php";
        
        //compteur de style
        $i = 0;
        //connexion BDD 
        sql_connect($host,$user,$passwd,$bdd);
         
        $reponse = mysql_query("SELECT id,titre,url FROM annuaire ") or die(mysql_error());
        $total = mysql_num_rows($reponse);
        
        ?>
        <h2>Résultat d'analyse : <?php echo($total); ?> sites analysés - <span
        	class="error"><?php echo($i); ?> erreurs</span></h2>
        <table>
        	<thead>
        		<tr>
        			<th>ID</th>
        			<th>Nom du site</th>
        			<th>URL</th>
        			<th>Type d'erreur</th>
        			<th>Correction proposée</th>
        			<th>Actions</th>
        		</tr>
        	</thead>
        	<tbody>
        	<?php
        	while ($donnees = mysql_fetch_array($reponse) )
        	{
        		$id = $donnees['id'];
        		$titre = $donnees['titre'];
        		$url = $donnees['url'];
        		$url_parsee = parse_url($url);
        		$host = $url_parsee["host"];
        		$path = isset($url_parsee["path"]) ? trim($url_parsee['path']) : '';
        		$tab_return = check_connect($host,$path);
        		if($tab_return["numerror"] != "200"){
        			$i++;
        			if($i%2 == 0){?>
        		<tr class="odd">
        			<td><?php echo($id);?></td>
        			<td><?php echo(utf8_encode($titre)); ?></td>
        			<td><a href=<?php echo($url); ?>><?php echo($url); ?></a></td>
        			<td class='errortypes'><span class='error'><?php echo($tab_return["numerror"]); ?>
        			</span><br />
        			<span class='secondary02'><?php echo($tab_return["message"]); ?></span></td>
        			<?php if($tab_return["numerror"] >= "300" && $tab_return["numerror"] <= "399"){ ?>
        			<td><input type='text' value="<?php echo($url); ?>" /> <a
        				href="<?php echo($url); ?>" title='Visiter'><img class='imgbutton'
        				src='../images/search_24.png' alt='Visiter' /></a></td>
        				<?php }else{ ?>
        			<td><input type='text' value='' /></td>
        			<?php }?>
        			<td><a href='' onclick="request('fonction/supprimer.php?id=<?php echo($id); ?>','xmlhttp');return(false)" title='Supprimer'><img class='imgbutton'
        				src='../images/delete_24.png' alt='Supprimer' /></a><a href='#'
        				title='Enregistrer'><img class='imgbutton'
        				src='../images/save_24.png' alt='Enregistrer' /></a></td>
        		</tr>
        		<?php }else{?>
        		<tr id=<?php echo($id);?> >
        			<td><?php echo($id);?></td>
        			<td><?php echo(utf8_encode($titre)); ?></td>
        			<td><a href=<?php echo($url); ?>><?php echo($url); ?></a></td>
        			<td class='errortypes'><span class='error'><?php echo($tab_return["numerror"]); ?>
        			</span><br />
        			<span class='secondary02'><?php echo($tab_return["message"]); ?></span></td>
        			<?php if($tab_return["numerror"] >= "300" && $tab_return["numerror"] <= "399"){ ?>
        			<td><input type='text' value="<?php echo($url); ?>" /> <a
        				href="<?php echo($url); ?>" title='Visiter'><img class='imgbutton'
        				src='../images/search_24.png' alt='Visiter' /></a></td>
        				<?php }else{ ?>
        			<td><input type='text' value='' /></td>
        			<?php }?>
        			<td><a href='' onclick="request('fonction/supprimer.php?id=<?php echo($id); ?>','xmlhttp');return(false);" title='Supprimer'><img class='imgbutton'
        				src='../images/delete_24.png' alt='Supprimer' /></a><a href='#'
        				title='Enregistrer'><img class='imgbutton'
        				src='../images/save_24.png' alt='Enregistrer' /></a></td>
        		</tr>
        		<?php }
        		}
        	}
        	?>
        	</tbody>
        </table>
        
        • Partager sur Facebook
        • Partager sur Twitter
          10 février 2010 à 13:20:11

          On peut avoir le contenu de inspector.js ?
          • Partager sur Facebook
          • Partager sur Twitter

          problème actualisation jquery

          × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
          × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
          • Editeur
          • Markdown