XMLHttpRequest -> timeout and ontimeout doesnt work
-
I use the XMLHttpRequest in my QtQuick app in order to access a rest service. I'd like to react to the situation, if the rest service is gone. So I tried to use timeout and ontimeout to abort the request and do other stuff. But it doesnt work. Am I doing something wrong or is it just not compatible with QtQuick?
@
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.state === 200){
console.log("Response: " + xhr.responseText);
}
};xhr.open("GET", "http://myurl", true); xhr.timeout = 1000; xhr.ontimeout = function () { console.log("Timed out"); } xhr.send();
@
-
Hello,
i have not worked with XMLHttpRequest, so i can not help you, but this might:
- "XMLHttpRequest Example":http://qt-project.org/doc/qt-4.8/declarative-xml-xmlhttprequest-xmlhttprequest-example-qml.html
- "XMLHttpRequest":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-javascript-qmlglobalobject.html#xmlhttprequest
- "XMLHttpRequest from QML in Cascades":https://supportforums.blackberry.com/t5/Native-Development/You-CAN-use-XMLHttpRequest-from-QML-in-Cascades/td-p/2021907
- "Using XMLHttpRequest for HTTPS Post to server with SSL certificate":http://www.qtcentre.org/threads/44629-Using-XMLHttpRequest-for-HTTPS-Post-to-server-with-SSL-certificate
- "Google: QML XMLHttpRequest":https://www.google.de/search?q=qml+xmlhttprequest