aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind2015-03-31 16:36:36 +0200
committerMaZderMind2015-03-31 16:36:36 +0200
commita0c939e003dc52cf1f7858e1418ed281f15c37cc (patch)
tree79d887a2e7ed72403cd97557326024959ca45573
parent5c80bf0c039db7b7425b2aff2b34387fc3508be5 (diff)
Submit Form via Ajax and report Errors
Diffstat (limited to '')
-rw-r--r--assets/css/_structure.less3
-rw-r--r--assets/js/lustiges-script.js18
-rw-r--r--template/assemblies/feedback.phtml1
3 files changed, 19 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();
+ }
+ });
+
});
});
diff --git a/template/assemblies/feedback.phtml b/template/assemblies/feedback.phtml
index 3c29cfb..8476dee 100644
--- a/template/assemblies/feedback.phtml
+++ b/template/assemblies/feedback.phtml
@@ -144,4 +144,5 @@
</form>
<h3 class="feedback-thankyou">Thank you!</h3>
+<h3 class="feedback-error">The Feedback seems to be also broken…</h3>
<iframe name="feedback-target" style="display: none;"></iframe>