title: How to submit a form using jquery dialog button?
body: <p>Hello guys just want to ask about how can i process a form submission using the jquery dialog button. In my code I have a button that when you click. It will pop up a form in a dialog box. Below is the jquery buttons for OK and CANCEL. My problem is I can't submit my form the only option that I have is to create a submit button inside my form. But i want to use the jquery button instead. Im using CodeIgniter I hope you can help me.</p>
  
  <p>My view (showAllSuppliers.php)</p>
  
  <pre><code> /* FOR ADD PAGE */    
      $(".hero-unit input[name=add_supplier]").on('click',function(){
          $('#popup').load("&lt;?php echo site_url("supplier_controller/addNewSupplier/"); ?&gt;").dialog({
              title: "Add New Supplier",
              autoOpen: true,
              width: 800,
              modal:true,
              position: "center",
              buttons: {
                  OK: function(){
                       $("#addSupplier").submit(); //HOW CAN I SUBMIT MY FORM USING THIS?
                  },
                  CANCEL: function() {
                      $(this).dialog( "close" );
                  }
              }
          });
      });
  </code></pre>
  
  <p>my form (addNewSupplier.php)</p>
  
  <pre><code>&lt;?php
  $attr = array('id'=&gt;'addSupplier');
  echo form_open('supplier_controller/insertNewSupplier');  
  ..
  .. 
  ..
  ... MY TEXTBOX FIELDS HERE
  ..
  ..
  //echo "&lt;input type='submit' value='ADD' /&gt;"; ANOTHER OPTION FOR SUBMISSION
  echo form_close();
  ?&gt;
  </code></pre>
  
  <p>my controller function(supplier_controller.php)</p>
  
  <pre><code> public function insertNewSupplier(){
  
          $this-&gt;supplier_model-&gt;insertNewSupplierDetail();
          redirect('supplier_controller/index','refresh');
  
   }
  </code></pre>