PageSourceSearch

https://digiraha.ee/static/js/contact.js

js digiraha.ee collected 2026-10-06 15:00:59 UTC 2,855 bytes, 71 lines download raw bytes

1$(function() {
2  $('#contactForm').submit(function(e) {
3    e.preventDefault();
4
5    $("input,textarea").jqBootstrapValidation({
6        preventSubmit: true,
7        submitError: function($form, event, errors) {
8            // additional error messages or events
9        },
10        submitSuccess: function($form, event) {
11            event.preventDefault(); // prevent default submit behaviour
12            // get values from FORM
13            var name = $("input#name").val();
14            var email = $("input#email").val();
15            var message = $("textarea#message").val();
16            var firstName = name; // For Success/Failure Message
17            // Check for white space in name for Success/Fail message
18            if (firstName.indexOf(' ') >= 0) {
19                firstName = name.split(' ').slice(0, -1).join(' ');
20            }
21            $.ajax({
22                url: "./contact.php",
23                type: "POST",
24                data: {
25                    name: name,
26                    email: email,
27                    message: message
28                },
29                cache: false,
30                success: function() {
31                    // Success message
32                    $('#success').html("<div class='alert alert-success'>");
33                    $('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
34                        .append("</button>");
35                    $('#success > .alert-success')
36                        .append("<strong>Teie kiri on meile edastatud.</strong>");
37                    $('#success > .alert-success')
38                        .append('</div>');
39
40                    //clear all fields
41                    $('#contactForm').trigger("reset");
42                },
43                error: function() {
44                    // Fail message
45                    $('#success').html("<div class='alert alert-danger'>");
46                    $('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;")
47                        .append("</button>");
48                    $('#success > .alert-danger').append("<strong>Hea " + firstName + ", kahjuks ei ole hetkel võimalik meile teadet siit kaudu saata. Palun kirjutada meile otse.");
49                    $('#success > .alert-danger').append('</div>');
50                    //clear all fields
51                    $('#contactForm').trigger("reset");
52                },
53            })
54        },
55        filter: function() {
56            return $(this).is(":visible");
57        },
58    });
59
60    $("a[data-toggle=\"tab\"]").click(function(e) {
61        e.preventDefault();
62        $(this).tab("show");
63    });
64  });
65});
66
67
68/*When clicking on Full hide fail/success boxes */
69$('#name').focus(function() {
70    $('#success').html('');
71});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.