Skip to content

Instantly share code, notes, and snippets.

@TheOpenDevProject
Created August 24, 2015 11:20
Show Gist options
  • Save TheOpenDevProject/2b74308c423d97ada49a to your computer and use it in GitHub Desktop.
Save TheOpenDevProject/2b74308c423d97ada49a to your computer and use it in GitHub Desktop.
ValidateJSq
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