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 :
- <!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" xml:lang="fr">
- <head>
- <script src="./admin/js/prototype.js" type="text/javascript"></script>
- <script type="text/javascript">
- function loadProduct(idProduct) {
- var url = 'product.php';
- var parametres = 'idProduct=' + idProduct + '&idPage=' + <?php echo $_GET['id']; ?>;
- var myAjax = new Ajax.Updater(
- 'product',
- url,
- {
- method: 'get',
- parameters: parametres
- }
- );
- }
- </script>
- </head>
- <body>
- <form id="test" name="test">
- <div id="news">
-
- <?php
- if (!empty($data['titreProduit1']))
- echo "<p><a href=\"#\" onclick=\"javascript:loadProduct(1);\" class=\"productLink\">".$data['titreProduit1']."</a></p>";
- if (!empty($data['titreProduit2']))
- echo "<p><a href=\"#\" onclick=\"javascript:loadProduct(2);\" class=\"productLink\">".$data['titreProduit2']."</a></p>";
- ?>
-
- <br /><img src="./img/titre_savoir.png" alt="En savoir plus" title="En savoir plus" class="rubrique" />
-
- <div id="product" style="border: 1px solid black; width:150px; height: 100px;"></div>
-
-
- </div>
- </form>
- </body>
- </html>
|
Et mon fichier product.php
Code :
- <?php
- /*
- * Created on 9 sept. 07
- *
- * Author: Alexandre Billaud
- * email: albillaud@hotmail.com
- */
- // On inclue les connexion
- include_once('./conf/connexion.php');
- connexion();
- $sql = "SELECT titreProduit".$_GET['idProduct'].", texteProduit".$_GET['idProduct']." FROM ".PREFIXE."pages WHERE id_page = " .$_GET['idPage'];
- $req = mysql_query($sql) or die('Erreur SQL : <br />'.$sql); // On execute la requete
- $data = mysql_fetch_array($req);
-
- header("Content-Type: text/html; charset=ISO-8859-1" );
-
- echo '<p class="titreProduit>'.$data['titreProduit'.$_GET['idProduct']].'</p>';
- echo $data['texteProduit'.$_GET['idProduct']];
- ?>
|
Voila, si quelqu'un à une idée ca serait vraiment super.
Merci
Alex