473,698 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

my xhr does not work on ie

35 New Member
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. }
  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);
  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 1540
5,390 Recognized Expert Moderator Expert
what exactly is not working in IE?

kind regards
May 10 '09 #2
35 New Member
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');
  5. $nom=$_REQUEST["nom"];
  6. $email=$_REQUEST["email"];
  7. $message=$_REQUEST["message"];
  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{
  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>";
  32. }
  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
35 New Member
i changed to post method and it kinda solved the problem
May 10 '09 #4
5,390 Recognized Expert Moderator Expert
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
16,027 Recognized Expert Moderator MVP
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
35 New Member
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 .
May 11 '09 #7

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

Similar topics

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 InternetExplorer But then I cant see when a user exit my objIExplorer and than an error will show up when I try to open a link in the IE window that does not exist... What can I do about this and way does it not work in win 98?
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 puposes only and is not normally visable to the user.) The Thread function is actually in the Form class. Now.. What I am seeing is that when I create an instance of this Class Library's Form, which starts the worker thread, it seems to hose up...
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 can be done using the designer but I intentionally don't want to use that. The one reason is that you cannot change the code generated by the designer. The other could be that you have more free hand and control to design your GUI. 2....
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 used." Could anybody tell me why gets() function is dangerous?? Thank you very much. Cuthbert
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="" id="eventImage0" class="eventImage"><img src="" id="eventImage1" class="eventImage"></div>
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.