-
Notifications
You must be signed in to change notification settings - Fork 0
/
form.js
42 lines (36 loc) · 938 Bytes
/
form.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function onSubmit() {
var formData = {
name: $("#name").val(),
email: $("#email").val(),
message: $("#message").val(),
captcharesponse: grecaptcha.getResponse(),
};
$.ajax({
type: "POST",
url: "https://daetwyler.name/undolcedeliro.php",
data: formData,
dataType: "json",
encode: true,
}).done(function (success) {
if(success) {
$("#formular").html(
'<div class="alert alert-success">Ihre Nachricht wurde abgeschickt!</div>'
);
} else {
$("#error").html(
'<div class="alert alert-danger">Ein Fehler ist aufgetreten!</div>'
);
grecaptcha.reset();
}
$("#loading-bar").hide();
$("#formular").show();
});
}
$(document).ready(function () {
$("#reservationsformular").submit(function (event) {
event.preventDefault();
$("#formular").hide();
$("#loading-bar").show();
grecaptcha.execute();
});
});