Last active
June 20, 2016 00:46
-
-
Save glennr/e371cc614a91c5cc0de1970d01a0d581 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$('#contact').submit(function(e) { | |
var form = $(this); | |
var endpoint = form.prop('action'); | |
var data = form.serialize(); | |
var submitButton = $('button', form); | |
e.preventDefault(); | |
$.ajax({ | |
type: 'POST', | |
url: endpoint, | |
headers: { | |
Accept : "application/json; charset=utf-8", | |
}, | |
data: data, | |
beforeSend: function() { | |
submitButton.prop('disabled', 'disabled'); | |
} | |
}) | |
.done(function(data) { | |
submitButton.prop('disabled', false); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment