1$(function() { 2 3 $("input,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 message = $("textarea#message").val(); 14 var firstName = name; // For Success/Failure Message 15 // Check for white space in name for Success/Fail message 16 if (firstName.indexOf(' ') >= 0) { 17 firstName = name.split(' ').slice(0, -1).join(' '); 18 } 19 $.ajax({ 20 url: "././mail/contact_me.php", 21 type: "POST", 22 data: { 23 name: name, 24 email: email, 25 message: message 26 }, 27 cache: false, 28 success: function() { 29 // Success message 30 $('#success').html("<div class='alert alert-success'>"); 31 $('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×") 32 .append("</button>"); 33 $('#success > .alert-success') 34 .append("<strong>Your message has been sent. </strong>"); 35 $('#success > .alert-success') 36 .append('</div>'); 37 38 //clear all fields 39 $('#contactForm').trigger("reset"); 40 }, 41 error: function() { 42 // Fail message 43 $('#success').html("<div class='alert alert-danger'>"); 44 $('#success > .alert-danger').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×") 45 .append("</button>"); 46 $('#success > .alert-danger').append("<strong>Sorry " + firstName + ", it seems that my mail server is not responding. Please try again later!"); 47 $('#success > .alert-danger').append('</div>'); 48 //clear all fields 49 $('#contactForm').trigger("reset"); 50 }, 51 }) 52 }, 53 filter: function() { 54 return $(this).is(":visible"); 55 }, 56 }); 57 58 $("a[data-toggle=\"tab\"]").click(function(e) { 59 e.preventDefault(); 60 $(this).tab("show"); 61 }); 62}); 63 64 65/*When clicking on Full hide fail/success boxes */ 66$('#name').focus(function() { 67 $('#success').html(''); 68});
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.