title: jQuery dialog: how to prevent closing the dialog + an extra get request!
body: <p>The work flow:
  user click the button, a dialog box opens with a search form. An ajax post request is sent to the server, and get a json response. I get the callback on success handler. Now two issues.</p>
  
  <ol>
  <li><p>the dialog closes upon success callback (successFn). I get the json response in the success call back, and I want the user to see the result and press close button to terminate the dialog,.</p>
  
  <ol>
  <li>Soon after the dialog closes, a get request is sent to server. After closing the dialog by itself, the url is like <a href="http://localhost:8080/search?query=" rel="nofollow">http://localhost:8080/search?query=</a> . I do not send any GET request explicitly</li>
  </ol>
  
  <p>
   
  
  </p>
  
  <p></p>
  
         
  
      
          
      
  
  
   
  
   
  
   
          jQuery(document).ready( function(){       
              jQuery("#myButton").click( showDialog );
  
  <pre><code>        $myWindow = jQuery('#myDiv');
  
          $myWindow.dialog({ width: 400, autoOpen:false, title:'Hello World',
                  overlay: { opacity: 0.5, background: 'black'},  
                  modal: true,    
                  /*open: function (type, data) {
                      // include modal into form
                      $(this).parent().appendTo($("form:first"));
                  },      */          
                  buttons: {
                      "Submit Form": function() { $('form#myform').submit();},
                      "Cancel": function() {$(this).dialog("close");}
                          }
                  });
          });            
  
  
  var showDialog = function() {
      $myWindow.show(); 
      $myWindow.dialog("open");    
      }
  
  var closeDialog = function() {
      $myWindow.dialog("close");
  }
  
  var successFn = function (response) {   
          var obj = JSON.parse(response); 
          $("#result").html('').html(obj.name);
  }
  var errorFn =  function (xhr, ajaxOptions, thrownError){
              $("#myform").parent().html('').html(xhr.statusText);
              }
  var query = $("input#query").val(); 
  var dataString = 'query='+ query ;  
  
  $('form#myform').submit(function(){
      $.ajax({
          type: 'post',
          dataType: 'json',
          url: '/search',
          async: false,
          data: $("#myform").serialize(),
          success: successFn,
          error: errorFn
      });
  });     
  </code></pre>
  
  
  
  <p></p></li>
  </ol>