1$(function() { 2 3 $("#contactForm input,#contactForm textarea").jqBootstrapValidation({ 4 preventSubmit: true, 5 submitError: function($form, event, errors) { 6 // additional error messages or events 7 }, 8 submitSuccess: function($form, event) { 9 event.preventDefault(); // prevent default submit behaviour 10 // get values from FORM 11 var name = $("input#name").val(); 12 var email = $("input#email").val(); 13 var phone = $("input#phone").val(); 14 var message = $("textarea#message").val(); 15 var firstName = name; // For Success/Failure Message 16 // Check for white space in name for Success/Fail message 17 if (firstName.indexOf(' ') >= 0) { 18 firstName = name.split(' ').slice(0, -1).join(' '); 19 } 20 $.ajax({ 21 url: "././mail/contact_me.php", 22 type: "POST", 23 data: { 24 name: name, 25 phone: phone, 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'>×") 34 .append("</button>"); 35 $('#success > .alert-success') 36 .append("<strong>Your message has been sent. </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'>×") 47 .append("</button>"); 48 $('#success > .alert-danger').append("<strong>Sorry " + firstName + ", it seems that my mail server is not responding. Please try again later!"); 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/*When clicking on Full hide fail/success boxes */ 68$('#name').focus(function() { 69 $('#success').html(''); 70});
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.