0

我要在 web 服务调用期间在屏幕上应用一个对话框。我成功地做到了这一点

navigator.notification.activityStart("Wait", "loading....");

但我的问题是阻止它。我无法停止或让它从屏幕上消失。

navigator.notification.activityStop();

我使用的方法是:

/**
* Method to make a call to get all parking lots
* 
* @url: sensit.nedapavi.com/so.xml?Ln=sensit&Pw=sensit&Cm=6&Fm=A&Prklt=1
*/
function getParkingLots() {
    navigator.notification.activityStart();
    // making request object
    var request = new XMLHttpRequest();

    // making url
    var url = BASE_URL + "Ln=sensit&Pw=sensit&Cm=" + COMMAND_ID_PARKING_LOT + "&Fm=A";

    // making request object open and passes the url and type of request
    request.open("POST", url, true);

    // checking ready state of call
    request.onreadystatechange = function() {

        if (request.readyState === 4) {
            // request is ready and checking for status
            if (request.status === 200) {
                // converting xml response to json and then converting that
                // response to string
                var str = JSON.stringify(xmlToJson(request.responseXML));
                console.log("str: " + str);
                // parsing Json String
                var parkingLotJson = JSON.parse(str);
                console.log("getparkingLotJson: " + parkingLotJson);
                parseParkingLots(parkingLotJson);

                //stopping loader
                navigator.notification.activityStop();
            } else {
                // $.mobile.hidePageLoadingMsg();
                // showServerErrorAlert();
            }
        }
    }

    // sending request to Server
    request.send();

}

我正在使用上述方法。请帮我。

提前致谢。

4

0 回答 0