-
Notifications
You must be signed in to change notification settings - Fork 0
/
email.js
46 lines (39 loc) · 1.16 KB
/
email.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$(document).ready(function() {
$('#form-contact').submit(function(event) {
event.preventDefault();
var name = $('#name-form').val();
var email = $('#email-form').val();
var subject = $('#subject-form').val();
var message = $('#message-form').val();
var submit = $('#submit-form').val();
$('#message').load('email.php', {
name: name,
email: email,
subject: subject,
message: message,
submit: submit
}, function() {
$('#message').fadeIn('slow').delay(1500).fadeOut('slow');
if (name == "" && email == "" && subject == "" && message == "") {
$('#name-form').addClass("error");
$('#email-form').addClass("error");
$('#subject-form').addClass("error");
$('#message-form').addClass("error");
} else {
if(name == "") {
$('#name-form').addClass("error");
} else if(email == "") {
$('#email-form').addClass("error");
} else if(subject == "") {
$('#subject-form').addClass("error");
} else if (message == "") {
$('#message-form').addClass("error");
}
}
});
$('#name-form').val("");
$('#email-form').val("");
$('#subject-form').val("");
$('#message-form').val("");
});
});