From e45a2c350fa868e347eb16c1165a41149f5de10a Mon Sep 17 00:00:00 2001 From: danogentili Date: Wed, 17 Feb 2016 14:05:07 +0100 Subject: [PATCH] y --- index.html | 2 +- js/contact_me.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 153cf50..8c6deef 100644 --- a/index.html +++ b/index.html @@ -86,7 +86,7 @@ - + diff --git a/js/contact_me.js b/js/contact_me.js index 265e33c..be72b7d 100644 --- a/js/contact_me.js +++ b/js/contact_me.js @@ -1,6 +1,6 @@ $(function() { - $("input,textarea").jqBootstrapValidation({ + $("#contactForm input,#contactForm textarea").jqBootstrapValidation({ preventSubmit: true, submitError: function($form, event, errors) { // additional error messages or events @@ -9,7 +9,7 @@ $(function() { // Prevent spam click and default submit behaviour $("#btnSubmit").attr("disabled", true); event.preventDefault(); - + // get values from FORM var name = $("input#name").val(); var email = $("input#email").val(); @@ -30,9 +30,10 @@ $(function() { email: email, message: message, domain: domain - }, cache: false, + success: function(data) { + $("#btnSubmit").attr("disabled", false); if(data == "ok") { // Success message $('#success').html("
"); @@ -56,6 +57,7 @@ $(function() { } }, error: function() { + $("#btnSubmit").attr("disabled", false); // Fail message $('#success').html("
"); $('#success > .alert-danger').html("