Return to Snippet

Revision: 40210
at January 27, 2011 17:10 by dropthenerd


Initial Code
$('#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;	

});

Initial URL
http://www.dropthenerd.com/close-fancybox-when-you-submit-a-form-revisited

Initial Description

                                

Initial Title
Close a fancybox when you submit a form with ajax

Initial Tags
ajax, jquery

Initial Language
jQuery