Posted By

dropthenerd on 06/11/11


Tagged

ajax post jquery callback fancybox


Versions (?)

Close a fancybox ON form submit and BEFORE processing with ajax.


 / Published in: jQuery
 

URL: http://www.dropthenerd.com/close-fancybox-on-form-submit-but-before-processing-via-ajax/

  1. $("#MyForm").live('submit',function(){
  2. var params = $(this).serialize();
  3. var self = this;
  4.  
  5. $.ajax({
  6. type: 'POST',
  7. url: self.action,
  8. data: params,
  9. beforeSend: function(){
  10. alert('Closing');
  11. $.fancybox.close();
  12. },
  13. success: function(data){
  14. alert('Finished processing form');
  15. return false;
  16. },
  17. dataType: 'json'
  18. });
  19.  
  20. return false;
  21. });
  22. }

Report this snippet  

You need to login to post a comment.