Displaying Animation After Form Submission

Hi, I’ll like to display some animation in a modal window after clicking
the submit button and waiting for the form to process, and I’ll like
to return to the original page with a “Success” message after the
script has ended.

How do I do this?

Thanks

Are you using a scripting library such as jQuery or ExtJs or YUI or MooTools or something else similar?

If you’re using jQuery, it can be done this way.

using ajax

$.ajax({                                      
		   url: 'process.php',                         
		   data : "",                       
		   dataType: 'json',                   
		   success: function(data) {
		            
                            // use json_encode to print data from php file      
                          // process data		    

		   } // @success end
		 }); // @ajax end		

using load

function example_ajax_request() {
		$('#example-placeholder').html('<p><img src="ajax-loader.gif"  /></p>').each(function() {
  			setTimeout(function(){ $('#example-placeholder').load("ajax-loaded.html")}, 1000);
		});
	}