diff --git a/index.html b/index.html index afaf54c..289d564 100644 --- a/index.html +++ b/index.html @@ -86,18 +86,17 @@

You can also send me an email at c.marcandre[at]gmail.com, or fill the form below!

-
+

About you:

-

My name is , I'm a . You can contact me at .

+

My name is , I'm a . You can contact me at .

I'd like to tell you about ...

-

+

- +
-
diff --git a/js/form-handling.js b/js/form-handling.js new file mode 100644 index 0000000..8a8bb11 --- /dev/null +++ b/js/form-handling.js @@ -0,0 +1,22 @@ +var $contactForm = $('#contactme'); + +$contactForm.submit(function(e) { + e.preventDefault(); + $.ajax({ + url: '//formspree.io/c.marcandre@gmail.com', + method: 'POST', + data: $(this).serialize(), + dataType: 'json', + beforeSend: function() { + $contactForm.append('
Sending messageā€¦
'); + }, + success: function(data) { + $contactForm.find('.alert--loading').hide(); + $contactForm.append('
Message sent!
'); + }, + error: function(err) { + $contactForm.find('.alert--loading').hide(); + $contactForm.append('
Ops, there was an error.
'); + } + }); +}); \ No newline at end of file