pjs/extensions/xmlextras/tests/syncpost.html

24 строки
789 B
HTML

<html>
<body>
<h1>Posting test</h1>
<script>
var x = document.implementation.createDocument("", "test", null);
x.documentElement.appendChild(document.createTextNode("Foo"));
x.documentElement.appendChild(x.createElementNS("http://www.w3.org/1999/xhtml","h1"));
x.documentElement.lastChild.appendChild(document.createTextNode("My Document Header"));
x.documentElement.lastChild.setAttributeNS("http://www.w3.org/1999/xhtml","id","id1")
var p = new XMLHttpRequest();
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
p.open("POST", "http://green/cgi-bin/echo_xml.cgi", false);
p.send(x);
var d = p.responseXML;
var s = new XMLSerializer()
str = s.serializeToString(d);
alert(str);
alert(p.getAllResponseHeaders());
alert(p.responseText);
</script>
</body>
</html>