PageSourceSearch

https://dustedvalley.com/wp-content/themes/dusted-valley/js/ajax.js?ver=7.1

js dustedvalley.com collected 2026-09-26 10:44:12 UTC 2,014 bytes, 74 lines download raw bytes

1jQuery( document ).ready( function( $ ) {
2
3	$('button#subscribe').on('click', function(){
4		var error = false;
5		var firstName = $('input#first-name').val();
6		var lastName = $('input#last-name').val();
7		var email = $('input#email').val();
8
9		if (firstName.length==0) {
10			error = true;
11			if ($('div#first_name_box span.error').length == 0) {
12				$('div#first_name_box').prepend('<span class="error first_name">Enter Name</span>');
13			}
14			$('div#first_name_box input').addClass('error');
15
16		}
17		else {
18			$('div#first_name_box span.error').remove();
19			$('div#first_name_box input').removeClass('error');
20		}
21
22		if (lastName.length==0) {
23			error = true;
24			if ($('div#last_name_box span.error').length == 0) {
25				$('div#last_name_box').prepend('<span class="error last_name">Enter Last Name</span>');
26			}
27			$('div#last_name_box input').addClass('error');
28		}
29		else {
30			$('div#last_name_box span.error').remove();
31			$('div#last_name_box input').removeClass('error');
32		}
33
34		if (email.length==0 || !checkEmailAddress(email)) {
35			error = true;
36			if ($('div#email_box span.error').length == 0) {
37				$('div#email_box').prepend('<span class="error first_name">Enter Valid Email Address</span>');
38			}
39			$('div#email_box input').addClass('error');
40		}
41		else {
42			$('div#email_box span.error').remove();
43			$('div#email_box input').removeClass('error');
44		}
45
46		if (!error) {
47			var data = {
48				action: 'subscribe',
49				firstName: firstName,
50				lastName: lastName,
51				email : email
52			};
53
54			$.post(ajax_object.ajax_url, data, function(response) {
55				var json = $.parseJSON(response);
56				if (json['status']=='success') {
57					$('input#first-name').val('');
58					$('input#last-name').val('');
59					$('input#email').val('');
60					$('h3#message').html(json['message']);
61				}
62				else {
63					$('h3#message').html(json['message']);
64				}
65			});
66		}
67
68	});
69
70	checkEmailAddress = function(email){
71		var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
72		return regex.test(email);
73	}
74});

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.