blob: ca079edd257a80ca6596cdfb42276e295b811dbb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Initial form validation
$(document).ready(function() {
$.validate({
modules : 'html5, toggleDisabled'
});
});
// Revalidate on change
$('form[id=contactForm]').change(function() {
$.validate({
modules : 'html5, toggleDisabled'
});
});
// Async contact form
$('form[id=contactForm]').submit(function(){
$.post($(this).attr('action'), $(this).serialize(), function(res){
$('form[id=contactForm] #success').hide();
$('form[id=contactForm] #error').hide();
if (res.code == "200")
$('form[id=contactForm] #success').show();
}).fail(function(){
$('form[id=contactForm] #success').hide();
$('form[id=contactForm] #error').hide();
$('form[id=contactForm] #error').show();
});
return false;
});
// Callback function for captcha
function onSubmit(token) {
if (!token) {
return;
}
$('form[id=contactForm]').submit();
}
|