In the given code i have used one label and one button . i want that when i click on button a request must be sent which get the Json from the given link and print on label . but for this code i am just printing "OK" inside label upon success
The issue am facing is i am not getting into if statement. actually on Button clicked nothing happens. I know there is network manager in QT which i can use but in my situation i want to parse inside QML
// Default empty project template
import bb.cascades 1.0
// creates one page with a label
Page {
    Container {
        layout: StackLayout {}
        Label {
            id: msgLabel
            text: qsTr("Hello World")
            textStyle.base: SystemDefaults.TextStyles.BigText
            verticalAlignment: VerticalAlignment.Center
            horizontalAlignment: HorizontalAlignment.Center
        }
        Button {
            id: requestXML
            objectName: "requestXML"
            onClicked: {
                var doc = new XMLHttpRequest();
                doc.onreadystatechange = function() {
                    if (doc.readyState == 4) {
                        msgLabel.text="OK"
                        // pass “doc.responseText” to C++ for Parsing
                    }
                }
                doc.open("GET", "http://www.example.com/sample.json", true);
                doc.send();
            }
    }
    }
}
In my .pro file i have declared
CONFIG += qt warn_on cascades10
QT += network
CONFIG += debug
CONFIG += console
LIBS += -lbbdata
QT +=script
QT +=scripttools
Where i am wrong ? or i have to declare some thing else