Categories
Coding Websites

http AJAX fails in Internet Explorer

I ran across an interesting bug recently where I had an AJAX routine failing when I viewed the page in IE8. When you clicked the little warning icon in the lower left, it gave a message of “Object doesn’t support this property or method”!

It was failing around code that looks like:

function parseCalcResponse() {
if (http.readyState == 4 && http.status == 200) {
results = http.responseText;
results = results.split(“|||”);
document.getElementById(‘test’).innerHTML = results;
}
}

It turns out, the fix was to declare “results” at the top of the function code with:

var results=”;

And that fixed it!