/ Published in: jQuery
URL: http://www.dropthenerd.com/close-fancybox-when-you-submit-a-form-revisited
Expand |
Embed | Plain Text
$('#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; });
Comments
Subscribe to comments
You need to login to post a comment.

Would you be able to show me the validation side? when you post the data to the validation data page how does it send the data back to ajax?