473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

my xhr does not work on ie

35
it works perfect on safari and ff but not on ie,any thoughts?, thanks for your help

Expand|Select|Wrap|Line Numbers
  1. function xhr(){
  2. var xmlHttp=null;
  3. try{xmlHttp=new XMLHttpRequest();}
  4. catch (e){
  5. try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
  6. catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  7.   }
  8.  }
  9. return xmlHttp;
  10. }
  11.  
  12.  
  13. valid=new xhr();
  14. function validation(){
  15. var nom=document.forms.recommander_ce_blog.nom.value;
  16. var email=document.forms.recommander_ce_blog.email.value;
  17. var message=document.forms.recommander_ce_blog.message.value;
  18. valid.onreadystatechange = alertContents;
  19. valid.open('get',"validation_recommander_ce_blog.php?nom="+nom+"&email="+email+"&message="+message+"&id="+Math.random(), true);
  20. valid.setRequestHeader('If-Modified-Since','Wed, 05 Apr 2006 00:00:00 GMT');
  21. valid.send(null);
  22.  
  23.       }
  24. function  alertContents(){
  25. if (valid.readyState == 4) {
  26. result = valid.responseText;
  27. var div=document.getElementById('recommander_ce_blog_error_message')
  28. div.innerHTML = result;
  29. if (div.innerHTML=="<b>Merci!</b>"){
  30. document.getElementById("recommander_ce_blog").style.display="none";

the form:
Expand|Select|Wrap|Line Numbers
  1. <form  action="javascript:validation()"  id="recommander_ce_blog" name="recommander_ce_blog" >
  2. <table style="height: 148px;" border="0" width="282">
  3. <tr>
  4. <td>nom:</td>
  5. <td><input name="nom" type="text" /></td>
  6. </tr>
  7. <tr>
  8. <td>email:</td>
  9. <td><input name="email" type="text" /></td>
  10. </tr>
  11. <tr>
  12. <td valign="top">message:</td>
  13. <td><textarea name="message"></textarea></td>
  14. </tr>
  15. <tr>
  16. <td></td>
  17. <td><input name="submit_recommander_ce_blog" type="submit" value="Submit" /></td>
  18. </tr>
  19. </table>
  20. </form>
May 10 '09 #1
6 1531
gits
5,390 Expert Mod 4TB
what exactly is not working in IE?

kind regards
May 10 '09 #2
arty
35
on ie i only get the first php validation error(nom wich is name) and it stuck there

php validation code:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. Header('Cache-Control: no-cache');
  3. Header('Pragma: no-cache');
  4.  
  5. $nom=$_REQUEST["nom"];
  6. $email=$_REQUEST["email"];
  7. $message=$_REQUEST["message"];
  8.  
  9.  
  10. if(trim($nom)==""){
  11. print("un nom svp");
  12. }
  13. else if(trim($email)==""){
  14. print("un mail svp");
  15. }
  16. else if(!email_valid($email)){
  17.  print("un mail valide svp");
  18.     }
  19. else if(trim($message)==""){
  20.   print("un message svp");
  21. }
  22. else{
  23.  
  24. $to='dddd@gmail.com';
  25. $subject = 'nouveau message de votre site';
  26. $msg ='nom: '.$name.'<br />'.'Email: '.$email.'<br />'
  27. .'Message:'.nl2br($message);
  28. $headers='From:'.$email."\r\n".'Reply-To: '.$email."\r\n".'Return-Path: '.$email."\r\n".'Content-type: text/html; Charset=iso-8859-1';
  29. mail($to,$subject,$msg,$headers);
  30. print"<b>Merci!</b>";
  31.  
  32. }
  33.  
  34.  
  35.  
  36.  
  37. function email_valid ($email) {
  38. if (eregi("^[a-z0-9._-]+@[a-z0-9._-]+.[a-z]{2,4}$", $email))
  39.     { return TRUE; } else { return FALSE; }
  40. }
  41. ?>
May 10 '09 #3
arty
35
i changed to post method and it kinda solved the problem
May 10 '09 #4
gits
5,390 Expert Mod 4TB
glad to hear that you got it working ... even when it sounds strange ... did you receive the form's values correctly with GET?

kind regards
May 11 '09 #5
acoder
16,027 Expert Mod 8TB
Rather than using $_REQUEST, use $_GET or $_POST, so you can be sure nothing is overwritten.

According to the PHP code that you posted, only one error message can be printed at a time anyway.
May 11 '09 #6
arty
35
@gits
only the first form validation showed up(enter a name please) then it got stuck there(only for ie), the problem was very strange, the reason might be i am intergrating this into wordpress by trying to by pass everything related to wp, so the post method worked .
regards
May 11 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As...
5
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug...
14
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
89
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
14
by: webEater | last post by:
I have a problem, it's not browser specific, and I don't get a solution. I have an (X)HTML document, I show you a part of it: .... <!--<div class="pad">--> <div id="eventImages"><img src=""...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.