473,398 Members | 2,088 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.

Handler Does not work in Firefox

2
I created this generic AJAX Handler to work with Firefox and IE. However, it seems that somewhere in updating Firefox to 2.0.0.9 that the handler assigned to onreadystatechange is no longer getting called. This still works for IE.

Can someone help me add to this so that I can get it working with Firefox again?

Expand|Select|Wrap|Line Numbers
  1. var ASYNCH       = true;
  2. var REQUEST_TYPE = 'POST';
  3. var AJAX_URL     = '/ajax.cgi';
  4.  
  5. function httpRequest() {
  6.     // Mozilla-based browsers
  7.     if (window.XMLHttpRequest) {
  8.         ajaxRequest = new XMLHttpRequest();
  9.     }
  10.     // IE-based browsers
  11.     else if (window.ActiveXObject) {
  12.         ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
  13.  
  14.         if(! this.ajaxRequest) {
  15.             ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
  16.         }
  17.     }
  18.     // The request could still be null if neither ActiveXObject
  19.     // initialization succeeded
  20.     if (! ajaxRequest) {
  21.         alert("Your browser does not permit the use of all of this " +
  22.             "application's features");
  23.         return false;
  24.     }
  25.     ajaxRequest.onreadystatechange = this.handler; // DOES NOT WORK IN Firefox 2.0.0.9
  26.     ajaxRequest.open( REQUEST_TYPE, AJAX_URL, ASYNCH);
  27.     ajaxRequest.setRequestHeader("Content-Type",
  28.         "application/x-www-form-urlencoded; charset=UTF=-8"
  29.     );
  30.     ajaxRequest.send( this.queryString );
  31.     return true;
  32. }
Nov 7 '07 #1
5 2123
acoder
16,027 Expert Mod 8TB
Could you post the code for the handler?
Nov 7 '07 #2
Herkum
2
Could you post the code for the handler?
I think I did not make myself clear, the handler never gets called in Firefox. It works perfectly in IE and it HAD worked in Firefox before I upgraded it. So it is something specific to recent versions of Firefox.

I was hoping someone could help add some code to handle the problem that is occurring specifically to Firefox.
Nov 7 '07 #3
gits
5,390 Expert Mod 4TB
hi ...

have a look at the FF javascript-console ... are there any errors?

kind regards
Nov 7 '07 #4
Friends, try remove the code line follow:

ajaxRequest.onreadystatechange = this.handler;

I tried it, and this works perfectly at the FF, Chrome and IE 6, 7 and 8.

Kind regards.
Oct 14 '10 #5
gits
5,390 Expert Mod 4TB
then there is no response-handler?? how ist the response handled now?

this.handler in the original post had to be a handler-function which would have been to be declared for the custom httpRequest function/object ... and it is missing in the posted code ... at least there should be something like:

Expand|Select|Wrap|Line Numbers
  1. ajaxRequest.onreadystatechange = function(response) {
  2.     // do something with response
  3. };
Oct 15 '10 #6

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

Similar topics

3
by: Clarence Gardner | last post by:
I'm seeing surprising behavior, consistent across Opera, Firefox, and IE. An event handler is changing the value of an element, and there is apparently no Change event being generated for the...
1
by: cjl | last post by:
Hey all: I'm trying to write a cross-browser (IE and firefox) event handler for the mousewheel. Basically my web app is an image viewer, so if you scroll "down" with the wheel the next image...
3
by: jeff29_b | last post by:
I am having a strange problem on a web form. I have an image button with an OnClick event handler. When I click the image the event isn't being called in the code behind when browsing in firefox....
8
by: wASP | last post by:
Hi, I'm having a problem referencing the elements within an object after a method of that object (a member function) has been activated with an onsubmit handler: - - - - - - - - ...
4
by: David McNerney | last post by:
Would anyone be able to tell me why I get an error in FireFox 1.5.0.1 for MacOSX when I type some text and hit Enter in the following form: <html> <body> <form action="http://example.com"...
2
by: petermichaux | last post by:
Hi, I thought it is about time I tried writing some JavaScript with XMLHttpRequest instead of just using the Yahoo! UI library. The simple page below works in both Safari and Opera but I don't...
1
by: VAXman- | last post by:
I have code which is created from a content mamagement system. It places some handlers on tags with in-line registration: <tag... onmousedown="mousedownHandler(this);" ...> I want to...
3
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post by:
Note: My apologies for repeating this post from last week, but my nospam alias and profile account were incorrect. I think I have fixed this, so hopefully this post will trigger MS into a response...
2
by: wolverine | last post by:
Hi All, In Mozilla Firefox, to onblur and onfocus event of each and every html element, the browser itself will attach a native event handler. I mean if you type,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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
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
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.