XMLHttpRequest: problem with IE?

D

Dominic Myers

Hi there, I'm playing with XMLHttpRequest and
followed the article by Bill Bercik at
http://www.webpasties.com/xmlHttpRequest/... I'm
having problems getting the last two steps to work
though. The page that I'm working on is here:
http://camshag.co.uk/svg/XMLHttpRequest/. It works
fine in Firefox but there is no output for the zip
code 12345 (for example) on IE. There is no output
in Opera either but I guess that's just one of
those things ;-).
I'd welcome any advice but I'm guessing that this
is something to do with SP2 and security settings
or something...
Cheers, Dom
 
M

Martin Honnen

Dominic Myers wrote:

I'm
having problems getting the last two steps to work
though. The page that I'm working on is here:
http://camshag.co.uk/svg/XMLHttpRequest/. It works
fine in Firefox but there is no output for the zip
code 12345 (for example) on IE.

So the problem is that page
<http://camshag.co.uk/svg/XMLHttpRequest/step7/step7.html>
where you get a script error in IE for line
if (!isWorking && (http != false)) {
? You might want to change the strategy to return false and compare to
false and use null instead e.g.

function getHTTPObject() {
var httpRequest = null;
if (typeof XMLHttpRequest != 'undefined') {
httpRequest = new XMLHttpRequest();
}
else if (typeof ActiveXObject != 'undefined') {
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
}
catch (e) { }
@end @*/
}
return httpRequest;
}

then compare
if (httpRequest != null) {
// use it
}
 
P

phil_gg04

I thoroughly recommend the Sarissa library for XmlHttpRequest; it
provides a browser-independent interface that avoids these sorts of
problems entirely.

--Phil.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top