1 2function mailValidation(inputText) { 3 4 var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; 5 6 if (reg.test(inputText) == false) { 7 8 return false; 9 10 } 11 12 return true; 13 14 } 15 16 function validatenumber(inputText) { 17 18 // var reg = /^\d{1,15}$/; 19 // var reg = /^(\+?\d{1,15}(\s\d{1,15})*)$/; 20 // var reg = /^\+?[-\s\d]{6,16}$/; 21 22 var reg = /^\+?[-\s\d\(\)\+]{6,16}$/; 23 24 if (reg.test(inputText) == false) { 25 return false; 26 } 27 return true; 28 } 29 30 31 $('#new-footer-form').on('submit', function(event) { 32 event.preventDefault(); 33 34 var that = $(this); 35 var errorCount = 0; 36 $("#new-footer-form .with-errors").remove(); 37 $("#new-footer-form .border-danger").removeClass('border-danger'); 38 $("#new-footer-form").find(".mandatory").each(function() { 39 var that = $(this); 40 var inputVal = that.val(); 41 var inputId = that.attr("id"); 42 inputVal = $.trim(inputVal); 43 that.removeClass("border-danger"); 44 if (inputVal == "") { 45 that.addClass("border-danger"); 46 errorCount++; 47 } else if (inputId == "contactEmail") { 48 49 if (!mailValidation(inputVal)) { 50 // that.after('<div class="text-danger with-errors">Please Enter Valid Email!</div>'); 51 // that.addClass("border-danger"); 52 // errorCount++; 53 var errorMessage = "Please Enter Valid Eamil Id!"; 54 55 $('.error-mailid').text(errorMessage); 56 $('.input-group').addClass("border-danger"); 57 58 errorCount++; 59 } else { 60 // Remove the border-danger class and clear the error message if the input is valid 61 $('.error-mailid').text(""); 62 $('.input-group').removeClass("border-danger"); 63 64 } 65 66 } 67 68 else if (inputId == "contactPhone") { 69 if (!validatenumber(inputVal)) { 70 // that.after('<div class="text-danger with-errors">Please enter valid number</div>'); 71 // that.addClass("border-danger"); 72 // errorCount++; 73 var errorMessage = "Please Enter Valid Number!"; 74 // Select the .er div and set its text content to the error message 75 76 $('.error-message').text(errorMessage); 77 $('.input-group').addClass("border-danger"); 78 79 errorCount++; 80 } else { 81 // Remove the border-danger class and clear the error message if the input is valid 82 $('.error-message').text(""); 83 $('.input-group').removeClass("border-danger"); 84 } 85 } 86 }); 87 88 89 if(errorCount == 0){ 90 $('.loader').show(); 91 $.ajax({
92 url: 'contact-form-submit.php', 93 method: 'POST', 94 data: new FormData(this), 95 headers: { 96 'Accept': 'application/json' 97 }, 98 contentType: false, 99 processData: false, 100 error:err=>{ 101 console.log(err); 102 $('.loader').hide(); 103 },success: function(response) { 104 $('.loader').hide(); 105 if (response == 1) { 106 $('form').trigger('reset'); 107 location.href = 'thank-you.php'; 108 } else { 109 // alert('something went wrong please try again'); 110 console.log('something went wrong please try again'); 111 } 112 }, 113 }); 114 } 115 116 });
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.