PageSourceSearch

https://maththinking.com/assets/js/emailSending.js

js maththinking.com collected 2026-10-02 11:41:34 UTC 2,393 bytes, 96 lines download raw bytes

1function sendEmail() {
2	var editName = $('#edit-name').val();
3	if (BLANK_RE.test(editName)) {
4		alert("Please enter your name");
5		$('#edit-name').focus();
6		return;
7	}
8
9	var editMail = $('#edit-mail').val();
10	if (BLANK_RE.test(editMail)) {
11		alert("Please enter your email");
12		$('#edit-mail').focus();
13		return;
14	}
15	if (!emailCheck(editMail)) {
16		$('#edit-mail').focus();
17		return;
18	}
19
20	var editSubject = $('#edit-subject').val();
21	if (BLANK_RE.test(editSubject)) {
22		alert("Please provide a subject");
23		$('#edit-subject').focus();
24		return;
25	}
26
27	var editMessage = $('#edit-message').val();
28	if (BLANK_RE.test(editMessage)) {
29		alert("Please provide some messages.");
30		$('#edit-message').focus();
31		return;
32	}
33	
34	var recaptchaResponse = $('#g-recaptcha-response').val();
35	console.log('recaptchaResponse = ' + recaptchaResponse);
36	if (BLANK_RE.test(recaptchaResponse)) {
37		alert("Please resolve the captcha and submit!");
38		return;
39	}
40
41	$('#processing').show();
42	$.ajax({
43		type: "POST",
44		contentType: "application/x-www-form-urlencoded",
45		url: SEND_MESSAGE_URL,
46		data: {
47			name: editName,
48			email: editMail,
49			subject: editSubject,
50			message: editMessage,
51			recaptchaResponse: recaptchaResponse
52		},
53		cache: false,
54		dataType: "json",
55		success: function(data) {
56			$('#processing').hide();
57			console.log(data);
58			console.log(data.code);
59			if (data.code > 0) {
60				alert(data.message);
61			} else {
62				alert("Your message was sent. Someone will contact you shortly.");
63				afterSent();
64			}
65			
66			//$('#edit-submit').attr("disabled", "true");
67         //$('#contact-form').reset();
68         //$('#edit-submit').prop('disabled', true);
69         
70			
71		},
72		error: function(xhr, textStatus, error) {
73			$('#processing').hide();
74			console.log(error);
75			//alert(textStatus);
76            alert("We are sorry. Unexpected error ["+textStatus+"] occurred.\nPlease try again later.");
77         //$('#contact-form').reset();
78         //$('#edit-submit').prop('disabled', true);
79            //afterSent();
80		}
81	});
82}
83
84var afterSent = function() {
85   $('#edit-name').val('');
86   $('#edit-mail').val('');
87   $('#edit-subject').val('');
88   $('#edit-message').val('');
89   $('#edit-submit').prop('disabled', true);
90};
91
92$(function() {
93	$('#edit-submit').click(function() {
94		sendEmail();
95	});
96});

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.