Fundamentally, you'd use fadeOut on the element containing the form (perhaps the form element itself) and fadeIn on a "thank you" element.
Example:
$("#theForm").submit(function() {
var form = $(this);
// You'd do your `ajax` call here; I'll use `setTimeout`
// instead just to emulate the asynchronous nature of
// the `ajax` call
setTimeout(function() {
// This function would be your `success` callback
form.fadeOut("fast", function() {
// This is the callback when the `fadeOut` is complete; fade in the "thanks"
var thanks = $("<p>Thank you!</p>");
thanks.hide();
form.replaceWith(thanks);
thanks.fadeIn("fast");
});
});
return false; // Prevent form submission
});
Live copy