Bonjour.
Voici mon probleme:
Je voudrai pouvoir envoy� un mail par mon site web, mon site est bas� sur ajax, chaque lien fait une requ�te... etc.. Vous l'avez bien compris.
Tout se pass� bien, les balises que j'envoy� dans les requete �tait bien interpr�t�. Mais voici venir le <form> qui casse tout mes espoirs.
Voici le code php.
<?php
Le JS:
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 echo 'debut'; echo '<table width="500" border="0" cellspacing="0" cellpadding="0"> <form action="envoi.php" method="post" enctype="application/x-www-form-urlencoded" name="formulaire"> <tr> <td colspan="3">Envoyer un message</td> </tr> <tr> <td><div align="right">Votre nom</div></td> <td colspan="2"><input type="text" name="nom" size="45" maxlength="100"></td> </tr> <tr> <td width="17%"><div align="right">Votre mail</div></td> <td colspan="2"><input type="text" name="mail" size="45" maxlength="100"></td> </tr> <tr> <td><div align="right">Sujet :</div></td> <td colspan="2"><input type="text" name="objet" size="45" maxlength="120"></td> </tr> <tr> <td><div align="right">Message :</div></td> <td colspan="2"><textarea name="message" cols="50" rows="10"></textarea></td> </tr> <tr> <td></td> <td width="42%"><center><input type="reset" name="Submit" value="Réinitialiser le formulaire"></center></td> <td width="41%"><center><input type="submit" name="Submit" value="Envoyer"></center></td> </tr> </form> </table>'; ?>
Et le HTML:
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 function ajax(url) { var xhr=null; if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else if (window.ActiveXObject) { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } //on définit l'appel de la fonction au retour serveur xhr.onreadystatechange = function() { addtodiv(xhr); }; //on appelle le fichier reponse.txt xhr.open("GET", url, true); xhr.send(null); } function addtodiv(xhr) { var docXML= xhr.responseText; document.getElementById("dData").innerHTML = docXML; }
Donc j'ai fait plusieur petit teste:
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4 <a class="nouscontacter" onclick="javascript:ajax('./../php/contact.php');" href="#" >► Nous contacter ◄</a> <div id="dData" style="margin-top: 100px; margin-left: 25px; margin-right: 25px;" ></div>
- Si je met dans le code php, juste un tableau avec un form et un imput simple dedans cela fonctionne.
- Au niveau de la place que cela prend, ca fonctionne aussi: j'ai fait une page identique mais static, avec un include 'contact.php'; et ca fonctionne aussi.
Je ne sais plus trop quoi faire, merci de m'aid�.
Titioux.





R�pondre avec citation



Partager