title: Extjs confirm box callback handling
body: <p>In my ExtJs code I am checking the value of a warning flag.</p>
  
  <p>If the flag is set I want to show a confirm (OKCANCEL) box to the user where I ask the user if he wants to proceed even though there is a warning.</p>
  
  <p>Now just like any confirm box if the user clicks OK, the code should proceed to the next command in sequence and if he clicks CANCEL the code should return.</p>
  
  <p>Following is my code:</p>
  
  <pre><code>if(warning){
      Ext.MessageBox.show({
          title: 'Icon Support',
          msg: 'Are you sure you want to proceed?',
          buttons: Ext.MessageBox.OKCANCEL,
          icon: Ext.MessageBox.WARNING,
          fn: function(btn){
              if(btn == 'ok'){
              // go to the alert statement below.
              } else {
                  return;
              }
          }
      );
  
      alert('wants to proceed ahead'); //if user clicks OK then come here
  } 
  </code></pre>
  
  <p>Now the problem I am facing is when the code enters the <code>if</code> block it shows the message box and then it alerts <code>wants to proceed ahead</code>. </p>
  
  <p>I can stop that from happening by putting a <code>return;</code> statement before the <code>alert()</code>.</p>
  
  <p>But how do I go to the alert statement after the user clicks OK button?</p>