Проблема XMLHttpRequest в BlackBerry 10 (QML) - PullRequest
0 голосов
/ 09 января 2020

Здравствуйте, есть проблема с моим javascript. Вы можете помочь мне? Спасибо всем.

Когда у меня есть:

var url = "http://naucse-python.now.sh" // error -> Redirect to http://naucse-python.now.sh/ (308)

var url = "https://naucse-python.now.sh" // nothing is displayed

Когда у меня есть:

var url = "http://jsonplaceholder.typicode.com/todos/1" // everything is OK

var url = "https://jsonplaceholder.typicode.com/todos/1" // nothing is displayed
// main.qml
import bb.cascades 1.4

Page {

    function sendRequest() {
        var xhr = new XMLHttpRequest();

        var url = "http://naucse-python.now.sh"
        //var url = "http://jsonplaceholder.typicode.com/todos/1"

        xhr.onreadystatechange = function() {
            //if (xhr.readyState === XMLHttpRequest.DONE) {
                //if (xhr.status === 200) {

                    console.log(xhr.responseText);
                    textArea.text = xhr.responseText;
                //}
            //}
        };
        xhr.open("GET", url, true);
        xhr.send();
    }

    Container {

        TextArea {
            id: textArea
        }
    }

    onCreationCompleted: {
        sendRequest()
    }
}
...