JScript Wait Function

I have a function written in JScript (not javascript). I need to pause until some global variable becomes true. The global variable changes to true when another function is called after the ajax response:

function(req, event, data) {
        globalVariable = true;
    } 

When I try to loop until the variable is true:

while (globalVariable!= true) {
}

I turn into lively waiting and the callback function is never called.

Some suggested using WScript.wait (), but my application is not a stitch to know WScript. SetTimeout () will also not help, because it is an asynchronous call and does not suspend my original function.

Any other suggestion?

Additional information about my question: I want my script to call 2 functions:

waitWhileAjaxIsNotCompleted();
doSomthingElse();

, waitWhileAjaxIsNotCompleted() , ajax ( A4J) ajax. , , ajax, , ajax. globalVariable. waitWhileAjaxIsNotComplete() , glovalVariable. ( , ), doSomthingElse().

: QTP Web extensibilty toolkit ajax

+3
1

, , Jscript ( )... , script . .

, ...


. . , , ... , .

, , , , break; , GlobalVariable true.

, . , .

0

Source: https://habr.com/ru/post/1714711/


All Articles