Merge pull request #107 from cahillone/master

Prevent duplicate "Contact Us" messages
This commit is contained in:
David Miller 2017-08-19 16:32:39 -04:00 committed by GitHub
commit f130d4b295
2 changed files with 8 additions and 1 deletions

View File

@ -440,7 +440,7 @@
<div class="clearfix"></div>
<div class="col-lg-12 text-center">
<div id="success"></div>
<button class="btn btn-xl" type="submit">Send Message</button>
<button id="sendMessageButton" class="btn btn-xl" type="submit">Send Message</button>
</div>
</div>
</form>

View File

@ -17,6 +17,8 @@ $(function() {
if (firstName.indexOf(' ') >= 0) {
firstName = name.split(' ').slice(0, -1).join(' ');
}
$this = $("#sendMessageButton");
$this.prop("disabled", true); // Disable submit button until AJAX call is complete to prevent duplicate messages
$.ajax({
url: "././mail/contact_me.php",
type: "POST",
@ -49,6 +51,11 @@ $(function() {
//clear all fields
$('#contactForm').trigger("reset");
},
complete: function () {
setTimeout(function () {
$this.prop("disabled", false); // Re-enable submit button when AJAX call is complete
}, 1000);
}
});
},
filter: function() {