/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('#ajaxForm').submit(function(){ var params = $(this).serialize(); var self = this; $.post( '/ajax.php', params, function(data){ switch(data.status){ case 1: //success $.fancybox.close(); break; case 0: //failure console.log(data); $('#errorMessage').html(data.message); break; } }, 'json' ); return false; });
URL: http://www.dropthenerd.com/close-fancybox-when-you-submit-a-form-revisited