Note that there are some explanatory texts on larger screens.

plurals
  1. POJScript Wait function
    text
    copied!<p>I have a function written in JScript (Not javascript) I need to suspend until a certain global variable becomes true. The global variable is changed to true when another function is called after an ajax response:</p> <pre><code>function(req, event, data) { globalVariable = true; } </code></pre> <p>When I try to loop until the variable is true:</p> <pre><code>while (globalVariable!= true) { } </code></pre> <p>I go into a busy waiting and the callback function is never called.</p> <p>Some suggested the use of WScript.wait() but my app doesn't seam to know WScript. SetTimeout() also won't help because it's asynchronic call and won't suspend my original function.</p> <p>Any other suggestion?</p> <p>Some more information regarding my question: I want my script to call 2 functions:</p> <pre><code>waitWhileAjaxIsNotCompleted(); doSomthingElse(); </code></pre> <p>I want the <em>waitWhileAjaxIsNotCompleted()</em> to click a button that submits an ajax request (implemented by A4J) and terminate upon the ajax completion. In order for me to know when does tha ajax completed, I registered a function as a listener that will be awaken when the ajax completes. This function changes a globalVariable value. My <em>waitWhileAjaxIsNotComplete()</em> goes into an infinite loop, waiting for the glovalVariable value to change. When it does change (After the listener has awaken), I can end the function ad continue with the <em>doSomthingElse()</em> function.</p> <p>You can see more on the implementation on: <a href="https://stackoverflow.com/questions/1199534/qtp-web-extensibilty-toolkit-and-ajax">QTP Web extensibilty toolkit and ajax</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload