forked from extern/egroupware
No need to use Microsoft.XMLDOM for IE anymore, since IE 7+ supports XMLHttpRequest object
This commit is contained in:
parent
3e56f38995
commit
8f0dba15fe
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user