From 094d1f44fc1377af5b554e018502dac32ad83f36 Mon Sep 17 00:00:00 2001 From: Chad Cahill Date: Sat, 12 Aug 2017 11:26:11 -0700 Subject: [PATCH 1/2] add ID to Send Message Button --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 46332fe..39af01c 100644 --- a/index.html +++ b/index.html @@ -438,7 +438,7 @@
- +
From 0cfcc59805c26d221e25a8c1b9cb122dc1a03b71 Mon Sep 17 00:00:00 2001 From: Chad Cahill Date: Sat, 12 Aug 2017 11:32:03 -0700 Subject: [PATCH 2/2] Disable Submit Message Button during AJAX call Prevent duplicate messages --- js/contact_me.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/contact_me.js b/js/contact_me.js index 0e9a643..5323770 100644 --- a/js/contact_me.js +++ b/js/contact_me.js @@ -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() {