mirror of
https://github.com/voc/streaming-website
synced 2024-11-10 06:34:17 +00:00
Submit Form via Ajax and report Errors
This commit is contained in:
parent
5c80bf0c03
commit
a0c939e003
3 changed files with 19 additions and 3 deletions
|
@ -116,7 +116,8 @@ body.e500 {
|
|||
}
|
||||
|
||||
body.feedback {
|
||||
.feedback-thankyou {
|
||||
.feedback-thankyou,
|
||||
.feedback-error {
|
||||
font-size: @jumbo-font-size;
|
||||
text-align: center;
|
||||
padding: 30px;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue