473,398 Members | 2,165 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,398 software developers and data experts.

Works in IE8, but not in Safari?

I have a webpage where the user enters an email address and hits the tab key to activate a function onChange and I use Ajax to read a MySQL database and then displays a message if that email address is already on the database or not. It works fine in IE8, but in Safari it doesn't work. Here is my function to check for which XML Http Object:

Expand|Select|Wrap|Line Numbers
  1. function GetXmlHttpObject(){
  2. if (window.XMLHttpRequest)
  3. {
  4. // code for IE7+, Firefox, Chrome, Opera, Safari
  5. return new XMLHttpRequest();
  6. }
  7. if (window.ActiveXObject)
  8. {
  9. // code for IE6, IE5
  10. return new ActiveXObject("Microsoft.XMLHTTP");
  11. }
  12. return null;
  13. }
  14.  
And here is how I call it:

Expand|Select|Wrap|Line Numbers
  1. var xxmlHttp; 
  2.  
  3. xxmlHttp=GetXmlHttpObject();
  4. if (xxmlHttp==null){
  5. alert ("Browser does not support HTTP Request");
  6. return;
  7. }
  8.  
I am not getting the alert, it just tabs to the next field. What am I doing wrong. I need this to work with all browsers.

Thanks,
Fred
Jun 27 '10 #1
6 1463
@HawkMan24
OK, I put alerts in my function GetxmlHttpObject and it displays the alert saying that it got the xml requets for Safari. So why doesn't it display the message. I am sending the message to a div id tag that I have below the input textbox for the email address.

Expand|Select|Wrap|Line Numbers
  1. <div id="output1" style="color: blue;"></div>
and here is the code to check the email address for duplicate.

Expand|Select|Wrap|Line Numbers
  1. function omrCheckEmail(){
  2. var divid = 'output1'; 
  3. var loadingmessage = 'Processing...'; 
  4. var xxmlHttp; 
  5.  
  6. xxmlHttp=GetXmlHttpObject();
  7. if (xxmlHttp==null){
  8. alert ("Browser does not support HTTP Request");
  9. return;
  10. }
  11. xxmlHttp.onreadystatechange = function(){ 
  12. if (xxmlHttp.readyState > 0 && xxmlHttp.readyState < 4){ 
  13. document.getElementById(divid).innerHTML=loadingme ssage; 
  14. if (xxmlHttp.readyState == 4) { 
  15. emBoolean = xxmlHttp.responseText;
  16. if (emBoolean == 'true') {
  17. document.getElementById(divid).innerHTML="THIS EMAIL HAS REGISTERED!";
  18. }
  19. else {
  20. document.getElementById(divid).innerHTML="THIS EMAIL HAS NOT REGESTERED!";
  21. }
  22.  
  23. var queryString = '&email=' + (document.getElementById('custom').value);
  24.  
  25. xxmlHttp.open("POST", "omrCheckEmail.php", true);
  26. xxmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
  27. xxmlHttp.setRequestHeader("Content-length", queryString.length); 
  28. xxmlHttp.setRequestHeader("Connection", "close"); 
  29. xxmlHttp.send(queryString); 
  30. }
  31.  
And my omrCheckEmail.php returns either "true" or "false" accordingly.
Jun 27 '10 #2
Can anyone help me with this problem?
Jun 29 '10 #3
hsriat
1,654 Expert 1GB
Does it work in Firefox?... Have you seen what's happening in Firebug or error console?
Jun 30 '10 #4
@hsriat
I have only tested it on IE and Safari. It works fine on IE but not on Safari. I don't have Firefox on my computer.
Jun 30 '10 #5
Anybody have any ideas or suggestions? I really need to have this working in all browsers before I can put it out there. I am doing this as a volunteer for a national organization. Thanks!
Jul 2 '10 #6
@HawkMan24
Figured it out, thanks for nothing folks! LOL
Jul 3 '10 #7

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

Similar topics

14
by: DU | last post by:
According to a recent post, it seems that Konqueror 3.1+ and Safari 1.1 support CSS3 opacity style property under a proprietary name: "Support for the CSS3 opacity (using -khtml-opacity)...
2
by: Lutz Ißler | last post by:
Hi all! I dymically replace the child nodes of a DIV element by image nodes. In IE and Firefox this works properly. In Safari it works properly, too - but only if the site is called locally, eg....
2
by: jdlwright | last post by:
Hi, I have a big script that doesn't work in Safari 1.3, but does work in FF, and IE. I've given up going to my local Uni. to use their Macs (they've prevented the Debug menu from appearing...
34
by: Simon Wigzell | last post by:
document...focus() will scroll the form to move the specified text field into view on everything I have tried it with except Safari on the MAC. The form doesn't move. Any work around? Thanks.
12
by: effendi | last post by:
I wrote the following function and tested it in MSIE, Firefox and Mac Safari, Works in all but the Safari. What can I do to rectify this? function processBackground(){ for (n=1;n<11;n++) { ...
21
by: Edward | last post by:
Hi All, I feel frustrated with one of my Customers who wants me to ensure that a dotnet web site I am building for them must be compatible to Apple's Safari browser! Safari is buggy and it...
7
by: Tom | last post by:
I have an oo-type javascript program running perfectly on IE 6.0+, FF 1.5+, and Opera 7+ on Windows 98+, Linux (RH 9, FC 6), and Mac OS X. 4. As usual, the Safari browser is not working correctly,...
11
by: Stevo | last post by:
I've been using the unload event for a long time. I have this code, which I've abstracted and made into a stripped down simple test case below, and it works fine on the major browsers (IE5+,...
7
by: David Stone | last post by:
Run into something recently that has left me a little puzzled. According to the examples in section 13.6.1 of html 4.01... <http://www.w3.org/TR/html401/struct/objects.html#h-13.6.1.1> I...
3
by: Brad | last post by:
I have an aspx page that is sending pdf files to client browsers: it uses a filestream to read the pdf file and response.binarywrite to send content to the browser. This has worked great for years...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.