1
0
Fork 0

fix form validation (#236)

This commit is contained in:
Maxime 2017-11-09 13:32:00 +01:00 committed by Lucas Bonomi
parent 2c82ead943
commit 82cd80a8ff
2 changed files with 11 additions and 11 deletions

View file

@ -1,4 +1,4 @@
%form.join-form.gradient-white.pos-rel.z-10.p-xlarge.p-l-xxlarge.p-r-xxlarge.radius6.elevation1.m-l-r-auto{action: '#', method: 'POST'}
%form.join-form.join-form-fill.gradient-white.pos-rel.z-10.p-xlarge.p-l-xxlarge.p-r-xxlarge.radius6.elevation1.m-l-r-auto
%header.text-center
%h3.color-bunting.text-demi.no-margin.text-lg Get Started. Its FREE!
.spacer32
@ -25,7 +25,7 @@
%button.btn.btn-static-primary.w100p{type: 'submit'}
Join the program
%form.join-form.join-form-validated.hidden
%form.join-form.join-form-validated.gradient-white.pos-rel.z-10.p-xlarge.p-l-xxlarge.p-r-xxlarge.radius6.elevation1.m-l-r-auto.hidden
%h3 Thank you !
.spacer20
%p.text-sm

View file

@ -8,7 +8,8 @@
}
$('.join-form').on('submit', function(e) {
var $button = $(this).find('button');
e.preventDefault();
var $email = $(this).find('input[name="email"]');
var $url = $(this).find('input[name="url"]');
var $owner = $(this).find('input[name="owner"]');
@ -29,27 +30,26 @@
if (error) {
return false;
}
$button.attr('disabled', true);
$.ajax({
url: 'https://www.algolia.com/docsearch/join',
type: 'POST',
data: {
email: $email.val(),
url: $url.val(),
},
})
.done(function() {
url: $url.val()
}
}).done(function() {
pardotAppendIframe(
'https://go.pardot.com/l/139121/2016-08-05/ldp67?email=' +
encodeURIComponent($email.val()) +
'&website=' +
encodeURIComponent($url.val())
);
$('.join-form').hide();
$('.join-form-validated').show();
$('.join-form-fill').hide();
$('.join-form-validated').removeClass('hidden');
})
.fail(function() {
$button.attr('disabled', null);
alert('An error occurred, please try again later.');
});