Dialog automatically closes when opened.

Dialog automatically closes when opened.

Hello,

I guess first I will tell you that as soon as I click the button that opens the dialog, it pops up for a second, submits a blank form to the db and then closes.  Hopefully someone here can shed some light as to why it automatically closes on me before I get a chance to do anything.  Here is some of the code.  If you want more just let me know.
  1. $(document).ready(function() {
  2.   $("#dialog").load('includes/ajaxInsert.php', function(response, status, xhr) {    
  3.     if (status == "error") {
  4.       var msg = "Sorry but there was an error: ";
  5.       $("#error").html(msg + xhr.status + " " + xhr.statusText);
  6.     }
  7.   }).dialog({
  8.     modal: true,
  9.     autoOpen: false,
  10.     buttons: {
  11.       Cancel: function() {
  12.         $(this).dialog("close");
  13.       }
  14.     }
  15.   });
  16.   $(".submit").button().click(function () {
  17.     $("#dialog").dialog("open");
  18.   });
  19. });

and the HTML,
  1. <body>
  2.   <div id="container">
  3.     <div id="error"></div> <!-- error -->
  4.     <select class="select1">
  5.       <?php
  6.       include ('getDropDown.php');
  7.       ?>
  8.     </select>
  9.     <button class="submit">Add New</button>
  10.     <div id="dialog"></div> <!-- dialog -->
  11.   </div> <!-- container -->
  12. </body>