title: jquery overlay close after submit a form with ajax
body: <p>Hi I've tried everything, before asking you guys:</p>
  
  <pre><code>$(document).ready(function() {
  var triggers = $("a[rel]").overlay({
      expose: {
          color: '#212121',
          loadSpeed: 200,
          opacity: 0.9
      },
      api: true,
      closeOnClick: true
  });
  });
  
  $(document).ready(function(){
  
          $('#open_library').click(function (e) {     
              $('#OpenLib').slideToggle('slow');
              e.preventDefault();
              return false;
          });
  
  
      $forms = $('#library');
  $forms.bind('submit', function(){
          var $button = $('button',this).attr('disabled',true);
          var params = $(this.elements).serialize();
  
          var self = this;
          $.ajax({
              type: 'POST',
              url: this.action,
              data: params,
  
          beforeSend: function(){
                  $('#text_lib').show();
  
                  $('#text_lib').html("Loading...");
              },
              success: function(txt){
  
                  $button.attr('disabled',false);
  
                  $('#text_lib').html(txt);
  
                  self.overlay().close();
  
                  self.reset();
              },
  
              error: function(txt){
                  $('#text_lib').html(txt);
              }
          })
          return false;
      });
  });
  
  &lt;!--/* Begin PopLibrary*/--&gt;
  &lt;div id="PopLib"&gt;
      &lt;p style="color:#FFF; margin:0 0 30px 0"&gt;Add to Library&lt;/p&gt;
      &lt;form name="library" id="library" action="library_add.php"&gt;
          &lt;select name="idlibrary" id="idlibrary" class="select_dropdown1" style="width:280px" title="Please select an library"&gt;
              &lt;option value="0"&gt;Select one...&lt;/option&gt;
                  &lt;?php
                  if(isset($_COOKIE['cra_di']) AND $_COOKIE['cra_di'] != ''){
                      require_once("includes/php/user_info.php");
                      $library = $db-&gt;get_results("SELECT idlibrary, title FROM library WHERE user_id = $logged_user_id ORDER BY title ASC");
                      //echo print_r($library);
                      if($library) {
                          foreach($library as $k) {
                              echo '&lt;option value="' . $k-&gt;idlibrary . '"&gt;' . $k-&gt;title . '&lt;/option&gt;';
                          }
                      }
                  }
                  ?&gt;
          &lt;/select&gt;
          &lt;div class="PopLibrary"&gt;
        &lt;a href="#" class="grey_outter_link" id="open_library" style="font-size: 11px; text-decoration: underline;"&gt;Create new Library &lt;/a&gt;&lt;/div&gt;
          &lt;div id="OpenLib" style="display: none;"&gt;
              &lt;label&gt;Name&lt;/label&gt;
              &lt;input type="text" name="title" id="title" class="input_text required" maxlength="60" /&gt;
              &lt;label&gt;Comment&lt;/label&gt;
              &lt;textarea name="comment" style="margin: 5px 0 3px 0; height: 82px; width:218px" maxlength="336"&gt;&lt;/textarea&gt;&lt;br /&gt;
              &lt;input type="hidden" name="hidden_idproduct" id="hidden_idproduct" value="" /&gt;
              &lt;input type="hidden" name="hidden_type" id="hidden_type" value="" /&gt;
          &lt;/div&gt;&lt;!--/*OpenLib*/--&gt;
          &lt;div id="text_lib" style="margin-top:10px"&gt;&lt;/div&gt;
        &lt;div class="Inline" style="margin:30px 0 0 0"&gt;&lt;input type="image" src="image/add_file_btn.gif" value="submit" /&gt;&lt;/div&gt;&lt;div class="Inline" style="margin:30px 0 0 20px"&gt;&lt;button type="button" class="close" style=""&gt;&amp;nbsp;&lt;/button&gt; &lt;/div&gt;&lt;!--/*div*/--&gt;
      &lt;/form&gt;
      &lt;div class=" clear"&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;!--/*PopLib*/--&gt;
  &lt;!--/* End PopLibrary*/--&gt;
  </code></pre>