Created
June 16, 2012 16:23
-
-
Save ekka21/2941837 to your computer and use it in GitHub Desktop.
jQuery: Form validation, call back function ajax
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
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script> | |
$("#freeform").validate({ | |
submitHandler: function() { | |
$.ajax({ | |
url: "URL", | |
type: 'POST', | |
dataType: 'html', | |
data: ({ | |
name: $('#name').val(), | |
email: $('#email').val(), | |
ff_company: $('#ff_company').val(), | |
ff_date_needed: $('#ff_date_needed').val(), | |
ff_street: $('#ff_street').val(), | |
ff_city: $('#ff_city').val(), | |
ff_state: $('#ff_state').val(), | |
ff_zip: $('#ff_zip').val(), | |
ff_phone: $('#ff_phone').val(), | |
ff_logo_use: $('#ff_logo_use').val(), | |
option1000: $('#option1000').val(), | |
ff_requested_logos: $('#ff_requested_logos').val() | |
}), | |
success: function(data){ | |
if (data=="Email sent!"){ | |
alert('EMail sent!'); | |
}else{ | |
alert('Oh no, something went wrong!'); | |
} | |
} | |
}); | |
}//submitHandler | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment