aboutsummaryrefslogtreecommitdiff
path: root/assets/js/lustiges-script.js
diff options
context:
space:
mode:
authorMaZderMind2015-03-31 16:36:36 +0200
committerMaZderMind2015-03-31 16:36:36 +0200
commita0c939e003dc52cf1f7858e1418ed281f15c37cc (patch)
tree79d887a2e7ed72403cd97557326024959ca45573 /assets/js/lustiges-script.js
parent5c80bf0c039db7b7425b2aff2b34387fc3508be5 (diff)
Submit Form via Ajax and report Errors
Diffstat (limited to 'assets/js/lustiges-script.js')
-rw-r--r--assets/js/lustiges-script.js18
1 files changed, 16 insertions, 2 deletions
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();
+ }
+ });
+
});
});