1jQuery(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 = "contactus-sendmail.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 30 // let's compose Bootstrap alert box HTML 31 var alertBox = '<div class="alert ' + messageAlert + ' alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' + messageText + '</div>'; 32 33 // If we have messageAlert and messageText 34 if (messageAlert && messageText) { 35 // inject the alert to .messages div in our form 36 $('#contact-form').find('.messages').html(alertBox); 37 // empty the form 38 $('#contact-form')[0].reset(); 39 } 40 } 41 }); 42 return false; 43 } 44 }) 45});
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.