Created
August 24, 2015 11:20
-
-
Save TheOpenDevProject/2b74308c423d97ada49a to your computer and use it in GitHub Desktop.
ValidateJSq
This file contains hidden or 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
SimpleSendMail = { | |
FormComplete : true, | |
Events : { | |
SendButton_Click : $(document).on("ready",function(){ | |
$("#sendMail").on("click",function(event){ | |
$(".contact-widget :input[type='text']").each(function(){ | |
if($(this).val() === ''){ | |
SimpleSendMail.FormComplete = false; | |
$(this).effect( "shake" ); | |
} | |
}); | |
if(SimpleSendMail.FormComplete == true){ | |
var postData = { | |
FullName : $("#nameInput").val(), | |
SndrEmail : $("#emailInput").val(), | |
PhoneNumber : $("#numberInput").val(), | |
Message : $("#messageInput").val() | |
} | |
$.post( "/run/SimpleMail", postData) | |
.done(function( data ) { | |
alert("Thanks, We will get back to you shortly."); | |
window.location.reload(); | |
console.log(data); | |
}); | |
} | |
//Reset | |
$(".contact-widget :input[type='text']").each(function(){ | |
$(this).val(''); | |
}); | |
SimpleSendMail.FormComplete = true; | |
return false; | |
}); | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment