title: JQuery UI dialog showing waiting message until ajax call is processed
body: <p>I think that all is in the title. When I started this I thought it will be a 5 minutes codes or a quick result when googling... But It's now three hours I'm on this:</p>
  
  <p>Just show a dialog, with a "Please Wait..." message, while I'm performing an ajax call to retrieve some json result, and then show a "Result complete".</p>
  
  <pre><code>$('#switchOff').live("click",function(){
  
     $('#dialog').dialog({
                  modal:true,
  
                 open: function(){
  // I would like to call myAjax function
  //From here ?
  // While my dialog is showing the Wait message...
                 },
  
  
                  complete: function(){
  //close the dialog when fished
                   $('#dialog').dialog('close');
                           },
     }); 
  
  
  
  });
  
  function ajaxCall() {
                  //my ajax call
  }
  </code></pre>