/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] IE recognises onreadystatechange and status but FF does not

Hi all,

I am having trouble getting Firefox to play the game with regards to the script below.

[CODE]function connect(url) {
var xmlHttp;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e) {
// Internet Explorer
try {
xmlHttp=new ActiveXObject(“Msxml2.XMLHTTP”);
}
catch (e) {
try {
xmlHttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}
catch (e) {
alert(“Your browser does not support AJAX!”);
return false;
}
}
}
xmlHttp.open(“GET”, url, true);
xmlHttp.send(null);
xmlHttp.onreadystatechange = change;
function change() {
alert(xmlHttp.readyState);
if(xmlHttp.readyState == 4) {
alert(xmlHttp.status);
if (xmlHttp.status == 200) {
alert(xmlHttp.responseText);
} else {
alert(“remote status is not 200nremote status is: ” + xmlHttp.status);
}
}
}
}[/CODE]

In IE, the alerts come up as ‘2’, ‘3’, ‘4’ (for the ready states), ‘200’ (for the status) and then the responseText is also alerted.
In FF I get alerts ‘2’, then ‘4’, and then nothing.

Has anybody any idea what is happening here am sure it is ok.

Thanks all
John

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Angry_Black_ManAug 17.2007 — give us a working test page. i dont even have a url to test whatever it is youre doing to properly troubleshoot
Copy linkTweet thisAlerts:
@Angry_Black_ManAug 17.2007 — whenever stuff doesnt work in FF, always check the error console. that is the first and foremost step.

Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://www.forcesresources.co.uk/js/newsletter.js :: change :: line 95" data: no]

Source File: http://www.forcesresources.co.uk/js/newsletter.js

Line: 95[/quote]


i then googled "Component returned failure code: 0x80040111" which returned this page. im sure that will help you to fix your problem.
Copy linkTweet thisAlerts:
@postedoverseasauthorAug 17.2007 — Hi Aaron

Typical. I usually have the error console, DOM inspector and the normal FF window open at the same time but since I discovered the onerror command I have been using it less and it may have lured me into a false sense of security.

You were quite right, that did work, I changed the input type from submit to button and the onselect to onclick and now it works fine

Thanks again

John
×

Success!

Help @postedoverseas spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...