No need to use Microsoft.XMLDOM for IE anymore, since IE 7+ supports XMLHttpRequest object

This commit is contained in:
Hadi Nategh 2014-07-11 16:07:02 +00:00
parent 3e56f38995
commit 8f0dba15fe

View File

@ -24,36 +24,7 @@ function et2_loadXMLFromURL(_url, _callback, _context)
_context = null;
}
// Use the XMLDOM object on IE
if (window.ActiveXObject)
{
var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
// Set the callback function
xmldoc.onreadystatechange = function() {
if (xmldoc && xmldoc.readyState == 4)
{
// Find the root node - the root node is the node which is not
// the "xml", not a text node and not a comment node - those nodes
// are marked with an "#"
for (var i = 0; i < xmldoc.childNodes.length; i++)
{
var nodeName = xmldoc.childNodes[i].nodeName;
if (nodeName != "xml" && nodeName.charAt(0) != "#")
{
// Call the callback function and pass the current node
_callback.call(_context, xmldoc.childNodes[i]);
return;
}
}
throw("Could not find XML root node.");
}
}
xmldoc.load(_url);
}
else if (window.XMLHttpRequest)
if (window.XMLHttpRequest)
{
// Otherwise make an XMLHttpRequest. Tested with Firefox 3.6, Chrome, Opera
var xmlhttp = new XMLHttpRequest();