Code: Select all
var req = false;
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest)
{
try { req = new XMLHttpRequest(); }
catch(e) { req = false; }
}
// branch for IE/Windows ActiveX version
else if (window.ActiveXObject)
{
try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
catch(e)
{
try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e) { req = false; }
}
}
req.overrideMimeType('text/xml');
But, in IE, it works fine for the first time, but the next time I make use of AJAX nothing happens.
Code: Select all
req.onreadystatechange = req_foo;
function req_foo()
{
if (req.readyState == 1 || req.readyState == 2 || req.readyState == 3) // Open or Send or Receiving
{
// ..Loading..
}
if (req.readyState == 4) // Loaded
{
// only if "OK"
if (req.status == 200)
{
// Pull Remote data
}
}
}
Im guessing I have to reset the req variable after the first use - that is, in if (req.status == 200) block ?
Is there something Im missing here ?
Thanks