mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-06 05:59:15 +01:00
No need to use Microsoft.XMLDOM for IE anymore, since IE 7+ supports XMLHttpRequest object
This commit is contained in:
parent
b95f53f073
commit
1471def4b2
@ -24,36 +24,7 @@ function et2_loadXMLFromURL(_url, _callback, _context)
|
|||||||
_context = null;
|
_context = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the XMLDOM object on IE
|
if (window.XMLHttpRequest)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
// Otherwise make an XMLHttpRequest. Tested with Firefox 3.6, Chrome, Opera
|
// Otherwise make an XMLHttpRequest. Tested with Firefox 3.6, Chrome, Opera
|
||||||
var xmlhttp = new XMLHttpRequest();
|
var xmlhttp = new XMLHttpRequest();
|
||||||
|
Loading…
Reference in New Issue
Block a user