Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Regular Contributor
Posts: 76
Registered: ‎07-31-2012
My Device: Blackberry
My Carrier: Vodafone

Web Service call from QML using js

I can make Web Service call from QML using simple ajax calls.

 

function sendRequest() {
                var request = new XMLHttpRequest()
                request.onreadystatechange = function() {
                    if (request.readyState == 4) {
                        if (request.responseText != "") {
                            var json = JSON.parse(request.responseText)
                            if (json.status == "OK") {
                                console.log(json.data)
                            } else {
                                console.log(json.status)
                            }
                        } else {
                            console.log("Check data connectivity")
                        }
                    }
                }
                request.open("GET", myurl, true)
                request.send()
            }

 

We can make same calls using QNetworkRequest, QNetworkAccessManager & QNetworkReply in C++.

 

What approach would lead to better performance?