1$(function() { 2 3 // Get the form. 4 var form = $('#contact-form'); 5 6 // Get the messages div. 7 var formMessages = $('#form-messages'); 8 9 // Set up an event listener for the contact form. 10 $(form).submit(function(e) { 11 // Stop the browser from submitting the form. 12 e.preventDefault(); 13 14 // Serialize the form data. 15 var formData = $(form).serialize(); 16 17 // Submit the form using AJAX. 18 $.ajax({ 19 type: 'POST', 20 url: $(form).attr('action'), 21 data: formData 22 }) 23 .done(function(response) { 24 // Make sure that the formMessages div has the 'success' class. 25 $(formMessages).removeClass('error'); 26 $(formMessages).addClass('success'); 27 28 // Set the message text. 29 $(formMessages).text(response); 30 31 document.getElementById("contact-form").reset(); 32 window.location = "thankyou.php"; 33 // Clear the form. 34 /*$('#name').val(''); 35 $('#email').val(''); 36 $('#web').val(''); 37 $('#number').val(''); 38 $('#message').val(''); 39 $('#6_letters_code').val('');*/ 40 }) 41 .fail(function(data) { 42 // Make sure that the formMessages div has the 'error' class. 43 $(formMessages).removeClass('success'); 44 $(formMessages).addClass('error'); 45 46 // Set the message text. 47 if (data.responseText !== '') { 48 $(formMessages).text(data.responseText); 49 } else { 50 $(formMessages).text('Oops! An error occured and your message could not be sent.'); 51 } 52 }); 53 54 55 //$('#name').val(''); 56 //$('#email').val(''); 57 //$('#subject').val(''); 58 //$('#message').val(''); 59 60 61 }); 62 63});
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.