PageSourceSearch

https://thegrandbhagwati.com/assets/js/Contact_Us.js

js thegrandbhagwati.com collected 2026-10-07 16:12:14 UTC 4,776 bytes, 128 lines download raw bytes

1function contact_num_valid(evt) {
2    var theEvent = evt || window.event;
3    if (theEvent.type === 'paste') {
4        key = event.clipboardData.getData('text/plain');
5    } else {
6        var key = theEvent.keyCode || theEvent.which;
7        key = String.fromCharCode(key);
8    }
9    var count = (evt.target.value.match(/\+/g) || []).length;
10    if (count < 2 && key == '+') {
11        evt.target.value = evt.target.value.replace(/\+/g, "");
12        evt.target.value = '+' + evt.target.value;
13        theEvent.returnValue = false;
14        if (theEvent.preventDefault) theEvent.preventDefault();
15        return false;
16    }
17    var regex = /[+0-9]|\./;
18    if (!regex.test(key)) {
19        theEvent.returnValue = false;
20        if (theEvent.preventDefault) theEvent.preventDefault();
21    }
22}
23jQuery("#Contact_Us").submit(function(e) {
24jQuery(this).find('input[type="password"],input[type="text"],input[type="number"],input[type="tel"],input[type="email"],textarea').each(function(){jQuery(this).val($.trim(jQuery(this).val()));})
25function valid_contact()
26{	
27	var name=document.querySelector('#Contact_Us #name');
28	var email=document.querySelector('#Contact_Us #email');
29	var contact_no=document.querySelector('#Contact_Us #contact_no');
30	if(name.value=='')
31	{
32		document.querySelector('#Contact_Us #error_data').innerHTML = '* Please Enter Name.';
33		name.style.borderColor="red";
34		name.focus();
35		return false;
36	}
37	else{name.style.borderColor=""}
38	var digit = name.value;
39	var alpha = /^[a-zA-Z-,]+(\s{0,1}[a-zA-Z-, ])+(\s{0,1}[a-zA-Z-, ])*$/;
40	if(!alpha.test(digit)) {
41		document.querySelector('#Contact_Us #error_data').innerHTML = '* Invalid Name: ' + name.value;
42		name.style.borderColor="red";		
43		name.value = '';
44		name.focus();
45		return false;
46	}
47	else{name.style.borderColor=""}
48	if(email.value=='')
49	{
50		document.querySelector('#Contact_Us #error_data').innerHTML = '* Please Enter Email ID.';
51		email.style.borderColor="red";
52		email.focus();
53		return false;
54	}else{email.style.borderColor=""}
55	var c_reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
56	var c_address = email.value;
57	if(c_reg.test(c_address) == false) {
58		document.querySelector('#Contact_Us #error_data').innerHTML = '* Invalid Email ID: ' + email.value;
59		email.style.borderColor="red";
60		email.value = '';
61		email.focus();
62		return false;
63	}
64	else{email.style.borderColor=""}
65	if(contact_no.value=='')
66	{
67		document.querySelector('#Contact_Us #error_data').innerHTML = '* Please Enter Contact No.';
68	
69		contact_no.style.borderColor="red";
70		contact_no.focus();
71		return false;
72	}else{contact_no.style.borderColor=""}
73	var c_mobile = contact_no.value.replace(/\+/g,'');
74	var c_pattern = /^(?!(\d)\1+\b|1234567890)\d{10,}$/;
75	if (!c_pattern.test(c_mobile)) {
76		document.querySelector('#Contact_Us #error_data').innerHTML = '* Invalid Contact No.: ' + contact_no.value;
77		contact_no.style.borderColor="red";
78		contact_no.value = '';
79        contact_no.focus();
80		return false;
81	}else{contact_no.style.borderColor=""}
82	document.querySelector('#Contact_Us #error_data').innerHTML = '';
83	return true;
84}
85	if(valid_contact()==true){document.querySelector('#Contact_Us #form_process').style.visibility="visible";jQuery(this).find('[type="submit"]').prop('disabled', true);//.fadeOut('slow');
86		var form_url = jQuery("#Contact_Us").attr('action'); // the script where you handle the form input.	
87		$.ajax({
88			   type: "POST",
89			   url: form_url,
90			   data: jQuery("#Contact_Us").serialize(), // serializes the form's elements.
91			   success: function(data)
92			   {
93					var fomVal = jQuery.parseJSON(data);
94					if(fomVal.status == 1)
95					{
96						jQuery.ajax({
97							type: "POST",
98							url: "https://api.compubrain.com/api/MAIL_API.php",
99							data: fomVal,
100							success: function(response)
101							{
102								jQuery("#Contact_Us").empty();
103								jQuery("#Contact_Us").replaceWith(response);
104							},
105							error: function(error)
106							{
107								jQuery("#Contact_Us").empty();
108								jQuery("#Contact_Us").html("<div class='alert alert-danger'>Sorry! Some Technical issue occured. Please try again after sometime.</div>"); // show response from the php script.
109							}		
110						});
111					}
112					else
113					{
114						jQuery("#Contact_Us").empty();
115						jQuery("#Contact_Us").html("<div class='alert alert-danger'>Sorry! Some Technical issue occured. Please try again after sometime.</div>"); // show response from the php script.
116					}
117			   },
118			   error: function(data)
119			   {
120				   jQuery("#Contact_Us").empty();
121				   jQuery("#Contact_Us").html("<div class='alert alert-danger'>Sorry! Some Technical issue occured. Please try again after sometime.</div>"); // show response from the php script.
122			   }
123		});
124	
125			e.preventDefault();
126	}
127	else{e.preventDefault();}
128});

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.