How to submit a form in modal form

How to submit a form in modal form

Hi
 
Im new to JQuery and want to know how i can submit a form that is in a JQuery Dialog Modal Form.
 
I have a button on my main page, which opens up a modal form, with a form inside. Here are 2 snippets from the code.
 
  1. <script type="text/javascript">
       $(function(){
     

  2.     // Dialog   
        $('#dialog').dialog({
         autoOpen: false,
         width: 330,
         buttons: {
          "OK": function () {




  3.       alert("FORM SHOULD SUBMIT HERE");
          },
          "Cancel": function() {
           $(this).dialog("close");
          }
         }
        });
        
        // Dialog Link
        $('#dialog_link').click(function(){
         $('#dialog').dialog('open');
         return false;
        });
        
        //hover states on the static widgets
        $('#dialog_link, ul#icons li').hover(
         function() { $(this).addClass('ui-state-hover'); },
         function() { $(this).removeClass('ui-state-hover'); }
        ); 
              
       });
      </script>




















Code on the dialog.
  1. <div id="dialog" title="Search by Job Number"><form action="SearchByJob.asp" method="post" name="JobForm">
       <p>Enter Job Number:&nbsp;&nbsp; <input name="JobNumber" type="text" class="TextSmallBlack" id="JobNumber" size="30"></p><form>
      </div>

How can i get the form to submit to the SearchByJob page?. If i put $("JobForm").submit() under the OK function, nothing happens.