paulb@44 | 1 | function requestUpdate(url, elementName, targetName) { |
paulb@44 | 2 | var xmlhttp = Sarissa.getXmlHttpRequest(); |
paulb@44 | 3 | xmlhttp.open("GET", url, false); |
paulb@44 | 4 | xmlhttp.send(null); |
paulb@44 | 5 | //alert(xmlhttp.status); |
paulb@44 | 6 | //alert(xmlhttp.responseText); |
paulb@44 | 7 | var newDocument = Sarissa.getDomDocument(); |
paulb@44 | 8 | newDocument.loadXML(xmlhttp.responseText); |
paulb@44 | 9 | //alert(newDocument); |
paulb@44 | 10 | var newElement = newDocument.getElementById(elementName); |
paulb@44 | 11 | var targetElement = document.getElementById(targetName); |
paulb@44 | 12 | //alert(newElement); |
paulb@44 | 13 | //alert(targetElement); |
paulb@44 | 14 | |
paulb@44 | 15 | if (newElement != null && targetElement != null) { |
paulb@44 | 16 | var importedElement = document.importNode(newElement, true); |
paulb@44 | 17 | targetElement.parentNode.replaceChild(importedElement, targetElement); |
paulb@44 | 18 | //importedElement.setAttribute("style", "background-color:red;"); |
paulb@44 | 19 | } |
paulb@44 | 20 | } |