/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$("#MyForm").live('submit',function(){ var params = $(this).serialize(); var self = this; $.ajax({ type: 'POST', url: self.action, data: params, beforeSend: function(){ alert('Closing'); $.fancybox.close(); }, success: function(data){ alert('Finished processing form'); return false; }, dataType: 'json' }); return false; }); }
URL: http://www.dropthenerd.com/close-fancybox-on-form-submit-but-before-processing-via-ajax/