[thelist] AJAX Calls Working Intermittently in IE

Ben Dyer radicalbender at gmail.com
Wed Mar 12 10:15:48 CDT 2008

Hey all,

Tired of beating my head against a wall, so maybe someone here can help.

I've got a simple AJAX call to a database to retrieve a record of
pricing information given the values of three form fields.  I'm using
code that I've used on other sites before and (as usual) it works
flawlessly in Firefox.  IE6 and IE7, on the other hand, only process
the AJAX call occasionally and inconsistently.  Sometimes I'll change
the options around and the values will propagate correctly, but then
changing the options a second time will cause it to fail.  It's not
even the specific options themselves: trying the same options later
often won't work.

I've never seen anything like this before, where one browser will
intermittently process the XMLHttpRequest and the other will work 100%
of the time.  Also, it shouldn't have anything to do with the file
being queried.  It's returning the proper information when I call it
manually in IE.

Anybody have any hints?  Here's the site right now:

fishdirectmail.com/index.php  (trying to avoid links in the archive,
we're not ready for that just yet)

And here's the code in question:

if (window.XMLHttpRequest) {
	var req = new XMLHttpRequest();
else if (window.ActiveXObject) {
	var req = new ActiveXObject("Microsoft.XMLHTTP");
var URLCall = "include/_process/selectPrintPrice.php?PrintTypeID=" +
f.PrintTypeID.options.selectedIndex + "&MaxQty=" + f.Quantity.value +
"&ColorType=" + ColorType;
// Anything here will still work fine.  alert('Test') for example,
works great here.
req.onreadystatechange = function() {
	if ((req.readyState == 4) && (req.status == 200)) {
		// Anything after this point doesn't process.  Even a simple
alert(req.readyState + ' - ' + req.status); command displays nothing.

		// A bunch of processing code that works great in Mozilla.


Radical Bender

More information about the thelist mailing list