Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1382 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  [AJAX] Prototype et Ajax.Updater

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[AJAX] Prototype et Ajax.Updater

n°1611908
creusois
Posté le 15-09-2007 à 16:18:47  profilanswer
 

Bonjour à tous,
 
Voila, je m'en remet un peu à vous aujourd'hui car ca fait bien 3 heures que je butte sur un problème (très con je suis sur).
 
J'essaye de recharger un div via ajax avec la librairie prototype.  
Ca marche sous Firefox mais sous IE rien!!!
 
Je vous mets un peu de code:

Code :
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
  3. <head>
  4. <script src="./admin/js/prototype.js" type="text/javascript"></script>
  5. <script type="text/javascript">
  6.  function loadProduct(idProduct) {
  7.   var url = 'product.php';
  8.   var parametres = 'idProduct=' + idProduct + '&idPage=' + <?php echo $_GET['id']; ?>;
  9.   var myAjax = new Ajax.Updater(
  10.    'product',
  11.    url,
  12.    {
  13.    method: 'get',
  14.    parameters: parametres
  15.    }
  16.   );
  17.  }
  18. </script>
  19. </head>
  20. <body>
  21. <form id="test" name="test">
  22.   <div id="news">
  23.    
  24.     <?php
  25.       if (!empty($data['titreProduit1']))
  26.      echo "<p><a href=\"#\" onclick=\"javascript:loadProduct(1);\" class=\"productLink\">".$data['titreProduit1']."</a></p>";
  27.       if (!empty($data['titreProduit2']))
  28.      echo "<p><a href=\"#\" onclick=\"javascript:loadProduct(2);\" class=\"productLink\">".$data['titreProduit2']."</a></p>";
  29.     ?>
  30.  
  31.     <br /><img src="./img/titre_savoir.png" alt="En savoir plus" title="En savoir plus" class="rubrique" />
  32.    
  33.     <div id="product" style="border: 1px solid black; width:150px; height: 100px;"></div>
  34.    
  35.    
  36.   </div>
  37. </form>
  38. </body>
  39. </html>


 
 
Et mon fichier product.php
 

Code :
  1. <?php
  2. /*
  3. * Created on 9 sept. 07
  4. *
  5. * Author: Alexandre Billaud
  6. * email: albillaud@hotmail.com
  7. */
  8.   // On inclue les connexion
  9. include_once('./conf/connexion.php');
  10. connexion();
  11.   $sql = "SELECT titreProduit".$_GET['idProduct'].", texteProduit".$_GET['idProduct']." FROM ".PREFIXE."pages WHERE id_page = " .$_GET['idPage'];
  12.   $req = mysql_query($sql) or die('Erreur SQL : <br />'.$sql); // On execute la requete
  13.   $data = mysql_fetch_array($req);
  14.  
  15.   header("Content-Type: text/html; charset=ISO-8859-1" );
  16.  
  17.   echo '<p class="titreProduit>'.$data['titreProduit'.$_GET['idProduct']].'</p>';
  18.   echo $data['texteProduit'.$_GET['idProduct']];
  19. ?>


 
Voila, si quelqu'un à une idée ca serait vraiment super.  
 
Merci
 
Alex

mood
Publicité
Posté le 15-09-2007 à 16:18:47  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  [AJAX] Prototype et Ajax.Updater

 

Sujets relatifs
Cherche gallerie AJAXAJAX webservice et javascript
SetTimeout + ajax : comment faire ?ajax : innerhtml avec ie
appel javascript impossible dans page appelée en ajaxAJAX, div, input, et formulaire...
[Résolu] Erreur AJAXErreur AJAX -> Pas d'erreur...
Problème de previewing avec Javascript/AjaxPerformances d'un chat en Ajax ?
Plus de sujets relatifs à : [AJAX] Prototype et Ajax.Updater


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR