diff options
author | MaZderMind | 2015-03-31 16:36:36 +0200 |
---|---|---|
committer | MaZderMind | 2015-03-31 16:36:36 +0200 |
commit | a0c939e003dc52cf1f7858e1418ed281f15c37cc (patch) | |
tree | 79d887a2e7ed72403cd97557326024959ca45573 /assets | |
parent | 5c80bf0c039db7b7425b2aff2b34387fc3508be5 (diff) |
Submit Form via Ajax and report Errors
Diffstat (limited to 'assets')
-rw-r--r-- | assets/css/_structure.less | 3 | ||||
-rw-r--r-- | assets/js/lustiges-script.js | 18 |
2 files changed, 18 insertions, 3 deletions
diff --git a/assets/css/_structure.less b/assets/css/_structure.less index 5de12e0..a465bad 100644 --- a/assets/css/_structure.less +++ b/assets/css/_structure.less @@ -116,7 +116,8 @@ body.e500 { } body.feedback { - .feedback-thankyou { + .feedback-thankyou, + .feedback-error { font-size: @jumbo-font-size; text-align: center; padding: 30px; diff --git a/assets/js/lustiges-script.js b/assets/js/lustiges-script.js index ef685d0..447341f 100644 --- a/assets/js/lustiges-script.js +++ b/assets/js/lustiges-script.js @@ -380,9 +380,23 @@ $(function() { // feedback form $(function() { - $('.feedback-form').on('submit', function() { + $('.feedback-form').on('submit', function(e) { + e.preventDefault(); + var $form = $(this); + $('.feedback-form').hide(); - $('.feedback-thankyou').show(); + $.ajax({ + url: $form.prop('action'), + method: $form.prop('method'), + data: $form.serialize(), + success: function() { + $('.feedback-thankyou').show(); + }, + error: function() { + $('.feedback-error').show(); + } + }); + }); }); |