How to read the value of a variable which is set inside the jquery slide toggle calback function?
<p>I hope everyone is doing fine. My qyes actually I am setting a variable inside slide toggle call back function. I need to perform some action based on this variable's value So, I need to wait for this variable's value to be set in parent method. I think following code snippet will explain better what I am trying to do.</p>

<pre><code>    function() {
        $(this).next().slideToggle('normal',function(){
            if ($(this).is(':hidden')) 
            {
               state = "open";
            }
            else 
            {
               state = "close";
            } 
            isAnimationCompleted=true;
            return true;
    });

          while(isAnimationCompleted==false)
              {             
          //do nothing
              }
          isAnimationCompleted=false;
          var  selectedElement  =$.trim(this.textContent);
            if(state=="open" )
            {
                showHelp(selectedElement,state);
            }

        }
</code></pre>

<p>I will sincerely appreciate any help. thanks</p>
