-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.html
49 lines (45 loc) · 1.58 KB
/
example.html
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
42
43
44
45
46
47
48
49
<script type="text/javascript">
$(document).ready(function() {
$('#ahv-mail-form').submit(function(event) {
var url = "..."; // INSERT URL OF submit FUNCTION HERE
var data = {};
var form = $(this);
form.serializeArray().forEach(function(field) {
data[field.name] = field.value;
});
data.recipients = ['[email protected]'];
var button = $('#ahv-letter-submit');
button.prop('disabled', true)
button.text('Working...');
$.post(url, data).done(function() {
form.html('<p><strong>Thank you for your submission!</strong></p>');
}).fail(function(err) {
console.log('fail', arguments);
button.prop('disabled', false);
button.text('Submit your comment');
});
event.preventDefault();
});
});
</script>
<!-- INSERT THE FOLLOWING FORM INTO DESIRED LOCATION IN NB TEMPLATE -->
<div class="form">
<form method="post" id="ahv-mail-form">
<div class="row-fluid">
<div class="span5">
<label for="name">Your name</label>
<input type="text" name="name" class="text" />
</div>
<div class="span5 offset1">
<label for="email">Your email</label>
<input type="email" name="email" class="text" />
</div>
</div>
<label for="subject">Subject (e.g. address or name of the development)</label>
<input type="text" name="subject" class="text" />
<label for="content">Comments</label>
<textarea name="content"></textarea>
<button type="submit" id="ahv-letter-submit">Submit your comment</button>
</form>
</div>
</div>