Skip to content

Instantly share code, notes, and snippets.

@slavapas
Created March 21, 2017 12:58
Show Gist options
  • Save slavapas/7ba4401b08c026426a71562e924bfd60 to your computer and use it in GitHub Desktop.
Save slavapas/7ba4401b08c026426a71562e924bfd60 to your computer and use it in GitHub Desktop.
form submit ajax no reload
$('#reg-form').submit(function(e){
e.preventDefault(); // Prevent Default Submission
$('form :submit').prop('disabled', true); // disable submit button
$.ajax({
// ajax source
})
.done(function(data){
$('form :submit').prop('disabled', false); // enable submit button
})
.fail(function(){
alert('Ajax Submit Failed ...');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment