1 2jQuery(document).ready(function ($) { // wait until the document is ready 3 $('#send').on('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#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#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 if(error == true) { 25 $('#err-form').slideDown('slow'); 26 return false; 27 } 28 29 var data_string = $('#ajax-form').serialize(); // Collect data from form 30 31 $.ajax({ 32 type: "POST", 33 url: $('#ajax-form').attr('action'), 34 data: data_string, 35 timeout: 6000, 36 error: function(request,error) { 37 if (error == "timeout") { 38 $('#err-timedout').slideDown('slow'); 39 } 40 else { 41 $('#err-state').slideDown('slow'); 42 $("#err-state").html('An error occurred: ' + error + ''); 43 } 44 }, 45 success: function() { 46 $('#ajax-form').slideUp('slow'); 47 $('#ajaxsuccess').slideDown('slow'); 48 } 49 }); 50 51 return false; // stops user browser being directed to the php file 52 }); // end click function 53});
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.