diff options
Diffstat (limited to 'examples/declarative/xmlhttprequest/test.qml')
-rw-r--r-- | examples/declarative/xmlhttprequest/test.qml | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/examples/declarative/xmlhttprequest/test.qml b/examples/declarative/xmlhttprequest/test.qml new file mode 100644 index 0000000..18e328b --- /dev/null +++ b/examples/declarative/xmlhttprequest/test.qml @@ -0,0 +1,36 @@ +import Qt 4.6 + +Rectangle { + width: 800; height: 600 + + MouseRegion { + anchors.fill: parent + onClicked: { + + var doc = new XMLHttpRequest(); + doc.onreadystatechange = function() { + if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) { + console.log("Headers -->"); + console.log(doc.getAllResponseHeaders ()); + console.log("Last modified -->"); + console.log(doc.getResponseHeader ("Last-Modified")); + } + else if (doc.readyState == XMLHttpRequest.DONE) { + + var a = doc.responseXML.documentElement; + for (var ii = 0; ii < a.childNodes.length; ++ii) { + console.log(a.childNodes[ii].nodeName); + } + console.log("Headers -->"); + console.log(doc.getAllResponseHeaders ()); + console.log("Last modified -->"); + console.log(doc.getResponseHeader ("Last-Modified")); + + } + } + + doc.open("GET", "test.xml"); + doc.send(); + } + } +} |