diff options
Diffstat (limited to 'examples/declarative/xmlhttprequest/test.qml')
-rw-r--r-- | examples/declarative/xmlhttprequest/test.qml | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/examples/declarative/xmlhttprequest/test.qml b/examples/declarative/xmlhttprequest/test.qml index ef9d5f3..c7e7e6d 100644 --- a/examples/declarative/xmlhttprequest/test.qml +++ b/examples/declarative/xmlhttprequest/test.qml @@ -5,32 +5,32 @@ Rectangle { MouseArea { 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 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")); + var a = doc.responseXML.documentElement; + for (var ii = 0; ii < a.childNodes.length; ++ii) { + console.log(a.childNodes[ii].nodeName); } - 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")); + console.log("Headers -->"); + console.log(doc.getAllResponseHeaders ()); + console.log("Last modified -->"); + console.log(doc.getResponseHeader ("Last-Modified")); - } } + } - doc.open("GET", "test.xml"); - doc.send(); + doc.open("GET", "test.xml"); + doc.send(); } } } |