PageSourceSearch

http://techapp.org/js/contact.js

js techapp.org collected 2026-10-01 14:28:07 UTC 1,935 bytes, 50 lines download raw bytes

1$(function () {
2
3    // init the validator
4    // validator files are included in the download package
5    // otherwise download from http://1000hz.github.io/bootstrap-validator
6
7    // $('#contact-form').validator();
8
9
10    // when the form is submitted
11    $('#contact-form').on('submit', function (e) {
12
13        // if the validator does not prevent form submit
14        if (!e.isDefaultPrevented()) {
15            var url = "contact.php";
16
17            // POST values in the background the the script URL
18            $.ajax({
19                type: "POST",
20                url: url,
21                data: $(this).serialize(),
22                success: function (data)
23                {
24                    // data = JSON object that contact.php returns
25
26                    // we recieve the type of the message: success x danger and apply it to the 
27                    var messageAlert = 'alert-' + data.type;
28                    var messageText = data.message;
29                    // var messageCaptcha = data.message;
30
31                    // let's compose Bootstrap alert box HTML
32                    var alertBox = '<div class="alert ' + messageAlert + ' alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + messageText + '</div>';
33                    
34                    // If we have messageAlert and messageText
35                    // if (messageCaptcha) {
36                    //     $('#contact-form').find('.messages').html(alertBox);
37                    // }
38
39                    if (messageAlert && messageText) {
40                        // inject the alert to .messages div in our form
41                        $('#contact-form').find('.messages').html(alertBox);
42                        // empty the form
43                        $('#contact-form')[0].reset();
44                    }
45                }
46            });
47            return false;
48        }
49    })
50});

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.