-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
42 lines (36 loc) · 1.02 KB
/
scripts.js
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
37
38
39
40
41
42
(function () {
$(function () {
$('.get-in-touch').on('click', function () {
showForm();
});
$('.close-button').on('click', function () {
hideForm()
});
$('.send-button').on('click', function (event) {
event.preventDefault();
sendMail();
showSuccess();
});
})
function showForm () {
$('.contact-modal').addClass('contact-modal--visible');
}
function hideForm () {
$('.contact-modal').removeClass('contact-modal--visible');
}
function sendMail () {
var message = $('.form-name').val() + "(" + $('.form-email').val() + ") has requested help with " + $('.form-reason').val() + ".";
$.ajax({
url: "https://formspree.io/[email protected]",
method: "POST",
data: {message: message},
dataType: "json"
}).done(function (data) {
console.log(data);
});
}
function showSuccess() {
$('.contact-form').addClass('contact-form--hidden');
$('.contact-message').removeClass('contact-message--hidden');
}
}());