1 2jQuery(document).ready(function ($) { // wait until the document is ready 3 $('#send').click(function(){ // when the button is clicked the code executes 4 $('.error').fadeOut('slow'); // reset the error messages (hides them) 5 6 var error = false; // we will set this true if the form isn't valid 7 8 var name = $('input#contact_name').val(); // get the value of the input field 9 if(name == "" || name == " ") { 10 $('#err-name').fadeIn('slow'); // show the error message 11 error = true; // change the error state to true 12 } 13 14 var email_compare = /^([a-z0-9_.-]+)@([da-z.-]+).([a-z.]{2,6})$/; // Syntax to compare against input 15 var email = $('input#contact_email').val(); // get the value of the input field 16 if (email == "" || email == " ") { // check if the field is empty 17 $('#err-email').fadeIn('slow'); // error - empty 18 error = true; 19 }else if (!email_compare.test(email)) { // if it's not empty check the format against our email_compare variable 20 $('#err-emailvld').fadeIn('slow'); // error - not right format 21 error = true; 22 } 23 24 var message = $('textarea#contact_message').val(); // get the value of the input field 25 if(message == "" || message == " ") { 26 $('#err-message').fadeIn('slow'); // show the error message 27 error = true; // change the error state to true 28 } 29 30 if(error == true) { 31 $('#err-form').slideDown('slow'); 32 return false; 33 } 34 35 var data_string = $('#ajax-form').serialize(); // Collect data from form 36 //alert(data_string); 37 38 $.ajax({ 39 type: "POST", 40 url: $('#ajax-form').attr('action'), 41 data: data_string, 42 timeout: 10000, 43 error: function(request,error) { 44 if (error == "timeout") { 45 $('#err-timedout').slideDown('slow'); 46 } 47 else { 48 $('#err-state').slideDown('slow'); 49 $("#err-state").html('An error occurred: ' + error + ''); 50 } 51 }, 52 success: function() { 53 $('#ajax-form').slideUp('slow'); 54 $('#ajaxsuccess').slideDown('slow'); 55 } 56 }); 57 58 return false; // stops user browser being directed to the php file 59 }); // end click function 60});
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.