1function form_validation(page_name, form_name) { 2 var emailRegExp = 3 /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 4 var mobileRegExp = /^[6-9]\d{9}$/; 5 var numRegExp = /^[0-9]+$/; 6 7 var allowedDomains = [ 8 "gmail.com", 9 "hotmail.com", 10 "yahoo.com", 11 "yahoo.in", 12 "yahoo.co.in", 13 "rediffmail.com", 14 "outlook.com", 15 "icloud.com", 16 "live.com", 17 "ymail.com", 18 "rocketmail.com", 19 "vakrangeeconnect.com", 20 "zohomail.com", 21 "zohomail.in", 22 ]; 23 24 var full_name, contact_no, email_id; 25 full_name = $("#full_name").val(); 26 email_id = $("#email_id").val(); 27 contact_no = $("#contact_no").val(); 28 state = $("#state").val(); 29 30 var emailDomain = 31 email_id.indexOf("@") > -1 32 ? email_id.split("@")[1].toLowerCase().trim() 33 : ""; 34 35 if (full_name === "" || full_name.length <= 2) { 36 $("#msg").html( 37 "<span style='color:red'><strong>Please enter name</strong></span>", 38 ); 39 setTimeout(function () { 40 $("#msg").html(""); 41 }, 3000); 42 $("#full_name").focus(); 43 } else if (email_id == "") { 44 $("#msg").html( 45 "<span style='color:red'><strong>Please enter email</strong></span>", 46 ); 47 setTimeout(function () { 48 $("#msg").html(""); 49 }, 3000); 50 $("#email_id").focus(); 51 } else if ( 52 (email_id != "" && !email_id.match(emailRegExp)) || 53 email_id == "[email protected]" 54 ) { 55 $("#msg").html( 56 "<span style='color:red'><strong>Please enter proper email</strong></span>", 57 ); 58 setTimeout(function () { 59 $("#msg").html(""); 60 }, 3000); 61 $("#email_id").focus(); 62 } else if (allowedDomains.indexOf(emailDomain) === -1) { 63 $("#msg").html( 64 "<span style='color:red'><strong>Please enter valid email</strong></span>", 65 ); 66 setTimeout(function () { 67 $("#msg").html(""); 68 }, 3000); 69 $("#email_id").focus(); 70 } else if (contact_no === "" || !contact_no.match(mobileRegExp)) { 71 $("#msg").html( 72 "<span style='color:red'><strong>Please enter valid whatsapp number</strong></span>", 73 ); 74 setTimeout(function () { 75 $("#msg").html(""); 76 }, 3000); 77 $("#contact_no").focus(); 78 } else if (contact_no.length < 10 || contact_no.length > 10) { 79 $("#msg").html( 80 "<span style='color:red'><strong>Please enter proper whats number</strong></span>", 81 ); 82 setTimeout(function () { 83 $("#msg").html(""); 84 }, 3000); 85 $("#contact_no").focus(); 86 } else if (state === "") { 87 $("#msg").html( 88 "<span style='color:red'><strong>Please select state</strong></span>", 89 ); 90 setTimeout(function () { 91 $("#msg").html(""); 92 }, 3000); 93 $("#state").focus(); 94 } else { 95 $("#apply_btn").css("display", "none"); 96 $("#gif_image").css("display", "block"); 97 $.ajax({
98 url: page_name, 99 method: "post", 100 data: $("#" + form_name).serialize(), 101 success: function (data) { 102 if (data == 1) { 103 /* $("#msg").html("<span style='color:green'><strong>Popcorn Infotech team will contact you soon</strong></span>");*/ 104 //alert("Thank You ! We have received your details. Our experts will contact you shortly."); 105 window.location.replace("thankyou.php"); 106 setTimeout(function () { 107 $("#msg").html(""); 108 }, 3000); 109 $("#apply_btn").css("display", "block"); 110 $("#gif_image").css("display", "none"); 111 $("input:text").val(""); 112 $("textarea").val(""); 113 } else if (data == 3) { 114 $("#msg").html( 115 "<span style='color:red'><strong>Invalid Lead</strong></span>", 116 ); 117 setTimeout(function () { 118 $("#msg").html(""); 119 }, 3000); 120 $("#apply_btn").css("display", "block"); 121 $("#gif_image").css("display", "none"); 122 } else { 123 $("#msg").html( 124 "<span style='color:red'><strong>Something went wrong. Please try again</strong></span>", 125 ); 126 setTimeout(function () { 127 $("#msg").html(""); 128 }, 3000); 129 $("#apply_btn").css("display", "block"); 130 $("#gif_image").css("display", "none"); 131 } 132 }, 133 }); 134 } 135}
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.