JackLeo JackLeo - 1 year ago 68
jQuery Question

While variable is not defined - wait

I have

event that is triggered from other place automatically for the first time. My problem is that it runs to soon, since required variables are still being defined by flash and web services. So right now I have:

(function ($) {
}, 5000);

The problem is that 5 seconds for a person with a slow internet connection could be to fast and vice versa - for person with fast internet connection - its too damn slow.

So how should I do the delay or timeout until
is defined?

Answer Source

I would prefer this code :

 function checkVariable() {

    // here is your next action 


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download