Skip to content

Instantly share code, notes, and snippets.

@kinglozzer
Created July 14, 2015 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinglozzer/65ad05627c07299c1af1 to your computer and use it in GitHub Desktop.
Save kinglozzer/65ad05627c07299c1af1 to your computer and use it in GitHub Desktop.
$('#Form_InterestForm').on('submit', handleSubmit);
var handleSubmit = function(e) {
var form = $(this),
data = form.serialize();
form.find('input').attr('disabled', 'disabled');
$('#Form_InterestForm_action_doInterestForm').val('Submitting...');
$.ajax({
type: "POST",
url: form.attr('action'),
data: data,
success: function(data, textString, jqXHR) {
form.replaceWith(data);
$('#Form_InterestForm').on('submit', handleSubmit);
}
});
e.preventDefault();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment